Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Opening a Dialog/Frame from Applet

Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am openning Dialog/Frame from the Applet for some user inputs..
Now when user clicks on the applet this frame/dialog loses focus and goes back.
How do I keep it in front??
I tried Dialog.setModal(), it is not helping ...
For Frame, there is no setModal...
I would apprecaite if someone can suggest me the way to keep either frame/dialog in the front so that it does not go back when user clicks the applet...
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may use the "showInputDialog" method of JOptionPane class.
public static String showInputDialog(Component parentComponent, Object message)
Shows a question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed in the Component's frame, and is usually positioned below the Component.

parentComponent - the parent Component for the dialog
message - the Object to display
Rakesh Ray
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kazi for the reply.
I was looking solutin for jdk1.0...
Anyway I could find something as follows...
public Frame GetAppletFrame()
//Find out the Frame for the applet, which would be browser frame.
// Jdk1.0 do not have any method to find Applet's Frame.
// This function was need to overcome several java bugs.
// 1. We need to pass Frame of the applet to the Dialog so that it can remain modal
// 2. Applet's Cursor change does not work and we need to use Frame's Cursor functions.
Frame appletFrame=null;
Component parent = getParent(); //Get Applet's parent, presumable the browser Frame.
while ( (parent != null) && !(parent instanceof Frame))
parent = parent.getParent();

if (parent instanceof Frame)
appletFrame = (Frame)parent;
else //Incase you do not find the frame..
appletFrame = new Frame();
return appletFrame;
Create symphonies in seed and soil. For this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic