GlassPane component not displaying immediately
Posted on 2001-06-05
I have a Swing/JDK 1.3 application that (in a nutshell) retrieves a record from a database and displays the data in an editable screen.
When the user clicks the "Retrieve" button, I process the following instructions:
1) Create and display a GlassPane in the main JFrame that has the Cursor set to an Hourglass, and captures all mouse click events so the user can't click anything when it is displayed.
2) Retrieve the data from the database
3) Build the editable screen and display it
4) Hide the GlassPane
The problem I am experiencing is that even though I am telling the GlassPane to display itself in step one, it isn't actually displayed until after step 2 (or so).
I am able to work around this by putting the code for steps 2 and 3 in their own thread. Then the EventThread is able to display the GlassPane. I would rather NOT do it this way.
Does anyone have a clean way of doing this?