• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Glasspane and JDialog

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a module suite project in which I am trying to find a way to "lock" my
application after a certain period of time. To accomplish this, I am using
the main window's glass pane to consume mouse and keyboard input. But when I
have a modal dialog open, the glass pane opens under the dialog. I know that
I could set the modal dialog's glass pane visible, but that is not quite
what I want - I need to display a painted glass pane over the entire main
window. Anyone know of a way to do this?
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should be able to do this using the Layered Pane, but what happens when the dialog is visible outside the bounds of the frame?

If you want to make your application unusable, it's probably best to indicate this in the way the GUI looks as well, otherwise it will seem the application has crashed. Simply disable the frame and the dialogs using setEnabled(false).

Another way you could do this is create a modal dialog, which says that the program has locked. If you close the modal dialog, you could make the entire application exit.

What is it exactly that you want to achieve, and why? There are several ways to do it, but some are more suitable than others.
 
ravikumar Chilukuri
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stephan
sorry for the late reply....

actually i miss-understood my projects requirement and trying the things in a wrong way........

my requirement is to display an animated glass pane which consumes all events for a certain period...
but the glasspane should be on top of dailogs also....
please suggest me a way to do achieve this....

Thanks.

 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can add a glass pane to a JFrame and you can add a glass pane to each JDialog.

You can't use a glass pane to cover all frames and dialogs.

But when I have a modal dialog open,



Then don't use a glass pane. Create another modal dialog, using the original dialog as the owner, then all events will be consumed by this dialog.
 
This is my favorite tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic