I have a new netbeans "Java application" project, I am trying to add in a second JFrame from the main JFrame in which users can load files from.
So I have the main JFrame main method
public static void main(String args[])
{
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainView().setVisible(true);
}
});
}
Which when I hit run this is the JFrame that runs, in the same project I have defined another JFrame object, the input Frame. There is a button in the main frame that when hit, does a .setVisible on the statically defined input JFrame. But if I click "X" on the input frame the main frame also closes?
Any ideas?
No comments:
Post a Comment