Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is wrong with my Swing application?
    primarykey
    data
    text
    <p><strong>EDITED 2/2/2013</strong></p> <p>With the help of some of your answers and a simple Swing application guide I found, I was able to make a little bit of progress and I put it all in one class for now. However, I still can't get it to close and I had to make a button to do it because it was getting really annoying having to pull up task manager. The tooltips aren't working either. I don't know if it matters, but I'm doing it in Eclipse.</p> <pre><code>import javax.swing.SwingUtilities; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Thing extends JFrame { private static final long serialVersionUID = 1L; public Thing() { setTitle("Thing"); setSize(1024, 768); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); JPanel panel = new JPanel(); getContentPane().add(panel); panel.setLayout(null); panel.setToolTipText("A panel container"); JButton quit = new JButton("Quit"); quit.setBounds(50, 60, 80, 30); quit.setToolTipText("A button component"); quit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); panel.add(quit); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Thing thing = new Thing(); thing.setVisible(true); } }); } } </code></pre> <p>This is the error it gives when I try to close it with the X. (The closing works fine with the button)</p> <pre><code>java.lang.NoClassDefFoundError: sun/awt/TimedWindowEvent at sun.awt.windows.WToolkit.eventLoop(Native Method) at sun.awt.windows.WToolkit.run(Unknown Source) at java.lang.Thread.run(Unknown Source) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload