I have been out for a while, not that i am a good programmer. But when i made an application window in eclipse (new--- other---WindowBuilder--swing designer--application window)
this is the code it generates
import javax.swing.JFrame;
public class AddTournamentToRankingGUI {
private JFrame frame;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
AddTournamentToRankingGUI window = new AddTournamentToRankingGUI();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public AddTournamentToRankingGUI() {
initialize();
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 680, 814);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
I tried to resize in eclipse, no problem. then i hit run and hit the close button and tried to resize the GUI in eclipse again. This is where i cannot resize the window. only after a restart i can resize it in eclipse until i run the app again.
I have tried to add code to complete exit the application, but same result. This is the code i used
import javax.swing.JOptionPane;
import javax.swing.JFrame;
/*Some piece of code*/
frame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
if (JOptionPane.showConfirmDialog(frame,
"Are you sure you want to close this window?", "Close Window?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION){
System.exit(0);
}
}
});
Am i missing something here?