Link to home
Start Free TrialLog in
Avatar of guavamay
guavamay

asked on

How to call another class from main class

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);
               
            }
        });
    }
}
ASKER CERTIFIED SOLUTION
Avatar of wwnosal
wwnosal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of guavamay
guavamay

ASKER

Thanks for your help. It worked.