Java SWING: adding a JTextField (never used anywhere) randomly makes the screen go white?

Works for me, which makes me think it is a EDT issue. Move your call to setVisible to the end of your main method.

Works for me, which makes me think it is a EDT issue. Move your call to setVisible to the end of your main method. From this link: java.sun.com/products/jfc/tsc/articles/t... This method is thread safe, although most Swing methods are not.An application's GUI can often be constructed and shown in the main thread: The following typical code is safe, as long as no components (Swing or otherwise) have been realized: public class MyApplication { public static void main(String args) { JFrame f = new JFrame("Labels"); // Add components to // the frame here... f.pack(); f.show(); // Don't do any more GUI work here... } } All the code shown above runs on the "main" thread.

The f.pack() call realizes the components under the JFrame. This means that, technically, the f.show() call is unsafe and should be executed in the event-dispatching thread. However, as long as the program doesn't already have a visible GUI, it's exceedingly unlikely that the JFrame or its contents will receive a paint() call before f.show() returns.

Because there's no GUI code after the f.show() call, all GUI work moves from the main thread to the event-dispatching thread, and the preceding code is, in practice, thread-safe.

Thank you, this was the problem. – tsiki Apr 19 at 18:00.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions