tags:

views:

39

answers:

3
+3  A: 
  1. It's hard to answer this because it's not clear what the effects (Swing-wise) are of the calls to new AddInventoryScreen(); and new showStock();. You should only touch the UI that the user sees right at the end (when all the processing is done).

  2. You should really spin off methods that will take a long time into their own Thread (see SwingWorker. There are alternatives for Java 5.0). That way, the UI won't be blocked while it's processing.

  3. Maybe what you want is a Splash Screen?

Catchwa
+1  A: 

Try calling validate(); and pack(); methods before calling f.setVisible(true);

Your code can be

validate();
pack();
f.setVisible(false);
RaviG
+1  A: 

I think one big problem in your code (maybe not the only one however) is the fact that you should use a different thread for long operations.

GUI operations (creating swing components, adding them to panels, changing labels...) are to be performed exclusively in the "EDT" and must be short (typically, less than 100ms or even 50ms).

Long operations can be easily done by another thread if you use the SwingWorker API (part of JDK 1.6).

jfpoilpret