Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jason Perry   on Feb 11 In Java Category.

  
Question Answered By: Omar Walker   on Feb 11

Yes it is possible. Here is a fragment that show you
how you should do it...
.......
JButton loginButton = new JButton("ClickMe");
loginButton.addActionListener(

new ActionListener() { // inner class

public void actionPerformed(ActionEvent event) {
MyOtherFrame myScreen = new MyOtherFrame();

}

} // end inner class

); // end call to addActionListener

.........
Note:
MyOtherFrame is another class defined in their own
class file. What you can do is copy the class you
already have and rename the copy MyOtherFrame. Just a
suggestion I think will be easier to help  you, if you
can post the program or fragment where you're having
problem(s)!

Share: