Reputation: 542
I made a frame with some labels and a button on it, created an executable ear and now when i start it i can't move the application on my screen. Sometimes it works, sometimes it doesn't. I just can't drag the thing..
JFrame frame = new JFrame("Name"); frame.setPreferredSize(new Dimension(260, 160)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton exitButton = new JButton("Exit"); exitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); frame.add(exitButton, BorderLayout.SOUTH); frame.add(vertBox, BorderLayout.CENTER); frame.setVisible(true); frame.pack(); frame.setLocationRelativeTo(null);
Any ideas what's wrong? It's really annoying that i can't move it. P.S. There is a code part that i skipped, where i made the labels and added them
Upvotes: 0
Views: 1526
Reputation: 330
Perhaps (in the code you didn't show) you were disabling your frame through
frame.setEnabled(false);
PS: I know it has been 2 years since you asked the question, but it might help someone else
Upvotes: 1