



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




2
(from http://toastytech.com/guis/guitimeline.html) 3
5
8
while (true) { e = getEvent(); findEventHandler(e).actionPerformed(e); }
13
JFrame frame = new JFrame(“SwingApplication”); SwingApplication app = new SwingApplication(); Component contents = app.createComponents(); frame.getContentPane().add(contents, BorderLayout.CENTER);
frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
15
frame.pack(); frame.setVisible(true); }
17
“Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in the event dispatching thread.” java.sun.com tutorial
f.pack(); // f is realized here f.setVisible(true); // so isn’t this unsafe?
25