• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Opening a Dialog/Frame from Applet

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
Regards.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may use the "showInputDialog" method of JOptionPane class.
---------------------------------------------------
showInputDialog
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.

Parameters:
parentComponent - the parent Component for the dialog
message - the Object to display
 
Rakesh Ray
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic