I\'m new to swing, and was wondering why sometimes my application comes up as blank, and sometimes it displays the components. It seems to be sporadic. There are no exceptio
why sometimes my application comes up as blank, and sometimes it displays the components. It seems to be sporadic.
It is not sporadic, it happens when you miss a frame.pack()
call to tell the frame to pack all its components
Do the following and the frame should display ok:
mainFrame.add(componentHolder);
mainFrame.pack();
mainFrame.setVisible(true);
setVisible(true)
has to be the last method called in your Main method. Otherwise nothing may render on the JFrame