Start New Discussion within our Software Development Community


I've created a Button in one form. I've to make it work like, if I click on that button it should open another JFrame Form or JPanel form which I've created as

I don't know how to trigger this action..

Anyone can help me?


Add this in the method you want to launch your JFrame in.

JFrame frame = new JFrame("Title");
frame.add(new JLabel("new window!"));

^ What if I've some JFrame created in separate .java files.

E.g. I've a file (Which is JPanel) called, I've created a button on it. When a user clicks on that button, it should open a JFrame present in other .java file i.e.

How to implement such situation?

satdude, this thread is over a year old. if you have a problem, please start your own thread and be a bit more specific.
in a lot of "I have the same problem" posts, it turns out that even though it "seems" related, it's not.

This article has been dead for over six months. Start a new discussion instead.