Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Swing / AWT / SWT and the fly likes font size and JDialog box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "font size and JDialog box" Watch "font size and JDialog box" New topic

font size and JDialog box

oghenekaro EFEKODO
Ranch Hand

Joined: Oct 10, 2005
Posts: 56
i've being trying to implement the action event of the code below and whenever i try to use JDialog box to create an application where i can for instance click a button and a box appear with option to select,also coldn't use a text area.pls how do i go about it.pls, send code along.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FontSize extends JFrame{
private String[] size;
private JComboBox box;
private JTextArea area;
public FontSize(){
Container c=getContentPane();
c.setLayout(new FlowLayout());
size=new String[]{"8","10","12","14","16","17","18","20","26"};
area=new JTextArea(300,300);
c.add(new JScrollPane(area));
c.add(box=new JComboBox(size));
public static void main(String[] arg){
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> i've being trying to implement the action event of the code below

here's your code, with the actionListener added.
You mentioned something about a JDialog, I can't work out what you're trying
to do with that.

run the code, type something into the textArea, select a 'size' from the
comboBox, and the text will change size (unless you initially select '12'
which is the default size)

Don't get me started about those stupid light bulbs.
subject: font size and JDialog box