• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

font size and JDialog box

 
oghenekaro EFEKODO
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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)

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic