We help IT Professionals succeed at work.
Get Started

How to call another class from main class

guavamay
guavamay asked
on
434 Views
Last Modified: 2013-12-14
Hello,
I am calling my login class from my main class which is working. But I am not sure how to code to call my MainMenu class after I login successfully!
All the three classes are in same package. My login class has the connection code and my MainMenu class has tabbed pane which I am going to code later on. What I want to achieve at this point is to run main class which will display my login screen, after logged in successfully, display my MainMenu screen.  Can I add to call MainMenu class, the same way I am calling login in my main class
Could someone please help me?

Thanks.
Here is my code looks like in main class..

public class MyappMainClass {
   
    //Main method-need to add so that this class execute first
    public static void main(String[] args) {
        //Add method to call my login class from here
       java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Login().setVisible(true);
               
            }
        });
    }
}
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 2 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