We help IT Professionals succeed at work.
Get Started

Opening a JFrame window by calling an external class

Last Modified: 2012-05-11
I have a main menu that displays in a JFrame.  It has 3 buttons labeled:  Participants Menu, Prize Calculator and Exit.  Both the Prize Calculator and Participants Menu classes are external.  I copied the same code I used to open the Prize Calculator window, and modified it to open the Participants Menu but it is not working the same.  I am getting an error saying that the ParticipantsMenu isn't recognized.  I have verified that I am calling the right name.  Can you help me figure out what I am doing wrong?  
I am attaching the actual code and a screen shot so that you can see that it is being underlined by netbeans.   code.tiff
public void actionPerformed(ActionEvent e)
         Object source = e.getSource();
        if (source == exitButton)
        else if (source == calculatorButton)
            prizeCalculator object1 = new prizeCalculator();
            JFrame frame = object1.new prizeCalculatorFrame();
        else if (source == participantButton)
            ParticipantsMenu object = new ParticipantsMenu();
            JFrame frame = object.new ParticipantsMenuFrame();

Open in new window

Watch Question
Java Developer
Top Expert 2010
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE