At 07:32 PM 2/27/01 -0800, David King wrote:
>Hello.
>
>Is there a way to change the cursor to an hourglass so
>that no mouse events will occur until after some processing
>has finished?
>
>thanks, dave
>
>_______________________________________________
>Swing mailing list
>[EMAIL PROTECTED]
>http://eos.dk/mailman/listinfo/swing
> 


David,

You can use a glasspane to set the wait cursor and 
intercept events.

For example:

    private class GlassPane extends JComponent 
    {
        public GlassPane() 
        {
            addKeyListener(new KeyAdapter() { });
            addMouseListener(new MouseAdapter() { });
            super.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        }
     }                            


In the constructor of the dialog do:

     setGlassPane(new GlassPane()); 



When you want to disable the dialog:

dialog.getGlassPane().setVisible(true);

Then to re-enable it:

dialog.getGlassPane().setVisible(false);



_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to