• 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

Making JDialog visible

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a web application written in JSP. When a user clicks on certain buttons I want to display a modal YES_NO JDialog asking the user to confirm their selection (the easy part). However, despite using toFront(), setVisible() and show() methods, the window when first created remains behind the browser. Subsequent calls to display the message work fine. Is there a way of ensuring the window is to the front every time (without using javascript)?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since a JApplet isn't a Dialog/Frame/Window, there's no way for the JDialog to know what it is supposed to be displayed in front of. I think the standard work-around is to use a JInternalFrame instead of a dialog and display it on the glass pane (rather than the content pane) of the JApplet. You would also have to make the glass pane a mouse listener to block the user from clicking on the applet's controls.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But I don't think that's going to prevent the user from clicking on other things on the webpage... it's just going to prevent them from clicking other places on the JApplet.

I think that you're going to *have* to use a JavaScript dialog to do what you're trying to do.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic