aspose file tools*
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "font size and JDialog box" Watch "font size and JDialog box" New topic
Author

font size and JDialog box

oghenekaro EFEKODO
Ranch Hand

Joined: Oct 10, 2005
Posts: 56
pls,
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.
thanks.


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));
setSize(350,350);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] arg){
FontSize();
}
}
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)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: font size and JDialog box
 
Similar Threads
Action Listeners
Writing to a File
selecting item from a list to a table
GridBagLayout
How To make Button Display in JTextarea