Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with internalframe glassPane  RSS feed

 
sarvesh meens
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an internal frame. It has some buttons. When I click on
"Refresh" button,I have to prevent all mouse and keyboard actions on
the internal frame. After I receive the response,I have to allow user
actions on internal frame.

I tried to achieve this by the following logic:

* When user clicks on "Refresh",

Component glassPane = intenalFrame.getGlassPane();
glassPane.addMouseListener(new MouseAdapter(){});
glassPane.setCursor (Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
glassPane.setVisible(true);

* After obtaining response,

Component glassPane = intenalFrame.getGlassPane();
glassPane.setCursor (Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
glassPane.setVisible(false);

Problems with the above approach:

* Wait cursor is set but,user can still click on buttons. It seems,the glass pane is never really visible.
* Even when wait cursor is set,user can use keyboard and click buttons.

I used an alternate methodology. I created a glasspane of my own and set it for internal frame. The logic is explained below:

* creating glassPane:

JComponent glasspane = new JPanel();
glassPane.setOpaque(false);
glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
glassPane.addMouseListener(new MouseAdapter(){});

JComponent defaultPane = (JComponent) internalFrame.getGlassPane();

* When user clicks on "Refresh",

internalFrame.setGlassPane(glassPane);
glassPane.setVisible(true);

* After obtaining response,

internalFrame.setGlassPane(defaultPane);
defaultPane.setVisible(false);

Problems with the above approach:

* When user clickes on "Refresh" wait cursor is set. Mouse events are blocked only after the first mouse event i.e the first mouse click is still allowed.

* After getting response,default cursor is set. Mouse events are allowed only after the first mouse event i.e the first mouse click is not detected and doesnot have any effect on button.

* Even when wait cursor is in place and glasspane is visible,user can still click buttons using keyboard.

What should to be done to block mouse and keyboard input properly?

NB: I'm using java 1.3.1
 
Neil Daffodil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is Neil from Daffodil Software, India.

I studied your problem and my team at Daffodil would be in a position to help you out. If you could suggest a good time and a contact number where we can contact you and discuss this in detail then it would be great.

Thank You,

Neil
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!