How to call another class from main class

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?

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);
Who is Participating?
wwnosalConnect With a Mentor Commented:
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.
guavamayAuthor Commented:
Thanks for your help. It worked.
All Courses

From novice to tech pro — start learning today.