[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I  add a FontChooser class into my ActionPerformed method.

Posted on 2005-04-25
3
Medium Priority
?
205 Views
Last Modified: 2010-03-31
I previously asked about a font chooser, and someone gave me one. The problem is now I don't know how to make that class work in my action performed method that runs when my change font button is pressed. I got the FontChanger link is http://examples.oreilly.com/jswing2/code/ch12/FontChooser.java .  I would really appreciate anyone who could help me figure this out.
0
Comment
Question by:jasoncuevas
  • 3
3 Comments
 
LVL 15

Expert Comment

by:aozarov
ID: 13862855
FontChooser chooser =  FontChooser(your_frame_instance);
chooser.setVisible(true);

now you can call chooser.getNewFont() or chooser.getNewColor() or chooser.getAttributes()
0
 
LVL 15

Accepted Solution

by:
aozarov earned 2000 total points
ID: 13862865
If your action performed is inside anonymous inner class which is part of the JFrame (and lets say your JFrame name is MyJFrame) then you create the FontChooser
FontChooser chooser =  FontChooser(MyJFrame.this);
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13862866
sorry (missing the new):
FontChooser chooser =  new FontChooser(MyJFrame.this);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question