Tuesday, 17 September 2013

How can i launch a class from an actionlistener?

How can i launch a class from an actionlistener?

i have a basic gui class with a frame, a table, and a button. i want to
make it launch from the actilnlistener af another one of my basic gui
frames located in a different class
this is my main class:
public class IA {
public static void main(String[] args) {
MainFrame m1 = new MainFrame();
m1.setVisible(true);
}enter code here
public static void vts1 () {
ViewTeamStatistics v1 = new ViewTeamStatistics();
v1.setVisible(true);
}
}
it innitiates my main menu. and from the main menu i want to innitiate
another class named ViewTeamStatistics
this is the actionperformed. this is what is supposed to tell the program
to open the frame after i press the button
private void vtsActionPerformed(java.awt.event.ActionEvent evt) {
ViewTeamStatistics v1 = new ViewTeamStatistics();
v1.setVisible(true);
}
--------
the compiler comes back with no errors but when i run the program and
press the button nothing happens

No comments:

Post a Comment