Sembrano
Sembrano

Reputation: 1147

Calling a JDialog from another project?

I have application A that is a GUI for a company. I am making another application (B) and need to mock application A. I have done the mock as a seperate project and just tried to import my LoginDialog. But when I call it its not possible why? I have imported project B into my mocked project A the other project and added to my build path;

import com.bombardier.transport.se.gui.LoginFrame;

Then I try to call my loginFrame that is located in another project (B) :

JButton btnLogin = new JButton("Login");
        btnLogin.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {

                LoginFrame loginDialog = new LoginFrame();
                loginDialog.setVisible(true);
            }
        });

But it want me to create the loginDialog method in the application B and that the method .setVisible is undefind for this type. Thats not want I want to do. I just wanna open te dialog.

Why cant I do like this. It feels like I am trying to do something that you cant do right?

Upvotes: 0

Views: 112

Answers (1)

Lucas Eduardo
Lucas Eduardo

Reputation: 100

Create a public void open() {} method in the LoginFrame and put setVisible(true) there!

Then call loginFrame.open();

Upvotes: 1

Related Questions