-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
b53
-
generic
-
generic
Name: vi73552 Date: 03/22/99
I am running an application on Windows 95/NT. The application has internal frames which display the wait cursor and block input during long processing steps. The following code uses suggestions from other bug reports to do this by manipulating the internal frame's glass pane. The problem is that if the frame is iconified and then restored, the glass pane loses its state. The wait cursor no longer appears and the internal frame gets mouse and keyboard events.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class Demo
{
public static void main(String[] args)
{
//Display a frame with an internal frame and some components
JFrame aFrame = new JFrame();
JDesktopPane aDesktop = new JDesktopPane();
aFrame.setContentPane(aDesktop);
JInternalFrame anIFrame = new JInternalFrame();
JButton aButton = new JButton();
aButton.setText("Press me here");
JTextField aField = new JTextField();
anIFrame.getContentPane().setLayout(new GridLayout());
anIFrame.getContentPane().add(aButton);
anIFrame.getContentPane().add(aField);
anIFrame.setIconifiable(true);
anIFrame.setResizable(true);
anIFrame.pack();
aDesktop.add(anIFrame, BorderLayout.CENTER);
aFrame.pack();
aFrame.setSize(300, 200);
aFrame.show();
//Display a wait cursor over the internal frame and disable input
blockWindowInput(anIFrame);
}
public static void blockWindowInput(RootPaneContainer aContainer)
{
//Make the glasspane tack mouse events and show the wait cursor
Component glasspane = aContainer.getGlassPane();
glasspane.addMouseListener(new MouseAdapter(){});
glasspane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
glasspane.setVisible(true);
glasspane.requestFocus();
}
}
(Review ID: 55912)
======================================================================
I am running an application on Windows 95/NT. The application has internal frames which display the wait cursor and block input during long processing steps. The following code uses suggestions from other bug reports to do this by manipulating the internal frame's glass pane. The problem is that if the frame is iconified and then restored, the glass pane loses its state. The wait cursor no longer appears and the internal frame gets mouse and keyboard events.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class Demo
{
public static void main(String[] args)
{
//Display a frame with an internal frame and some components
JFrame aFrame = new JFrame();
JDesktopPane aDesktop = new JDesktopPane();
aFrame.setContentPane(aDesktop);
JInternalFrame anIFrame = new JInternalFrame();
JButton aButton = new JButton();
aButton.setText("Press me here");
JTextField aField = new JTextField();
anIFrame.getContentPane().setLayout(new GridLayout());
anIFrame.getContentPane().add(aButton);
anIFrame.getContentPane().add(aField);
anIFrame.setIconifiable(true);
anIFrame.setResizable(true);
anIFrame.pack();
aDesktop.add(anIFrame, BorderLayout.CENTER);
aFrame.pack();
aFrame.setSize(300, 200);
aFrame.show();
//Display a wait cursor over the internal frame and disable input
blockWindowInput(anIFrame);
}
public static void blockWindowInput(RootPaneContainer aContainer)
{
//Make the glasspane tack mouse events and show the wait cursor
Component glasspane = aContainer.getGlassPane();
glasspane.addMouseListener(new MouseAdapter(){});
glasspane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
glasspane.setVisible(true);
glasspane.requestFocus();
}
}
(Review ID: 55912)
======================================================================