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);
               
            }
        });
    }
}
guavamayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wwnosalCommented:
There is many ways to achieve this... Some of them might be:

1. Register a listener in your Login class that will be notified when login is successful (Main class can be such an listener)
2. Return some value from login object while the login is peformed and depending on the result value either proceed into displaying of MainMenu or display login again
3. Create another object that will agregate interaction between login and MainMenu objects.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
guavamayAuthor Commented:
Thanks for your help. It worked.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.