• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

font size and JDialog box

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
}
}
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic