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

Posted on 2005-04-25
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 .  I would really appreciate anyone who could help me figure this out.
Question by:jasoncuevas
    LVL 15

    Expert Comment

    FontChooser chooser =  FontChooser(your_frame_instance);

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

    Accepted Solution

    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);
    LVL 15

    Expert Comment

    sorry (missing the new):
    FontChooser chooser =  new FontChooser(MyJFrame.this);

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    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…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now