?
Solved

Making stay up frame when outside of frame clicked..

Posted on 2004-04-15
9
Medium Priority
?
263 Views
Last Modified: 2010-03-31
hi!

I have an applet and when I run it on web site floating JFrame pop up. Now, if I click outside of the JFrame, I guess the JFrame goes behind web browser frame. Do do I fix that?
****************************
  public void init() {

    wizardFrame = new JFrame("Configured");
    container = wizardFrame.getContentPane();
0
Comment
Question by:dkim18
  • 5
  • 3
9 Comments
 
LVL 13

Expert Comment

by:Webstorm
ID: 10836624
Hi dkim18,

>> I guess the JFrame goes behind web browser frame.
Only if you click on another window covering your Frame.

You can either

  * make the JFrame the same size as the screen :
    Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
    wizardFrame.setBounds(0,0,screen_size.width,screen_size.height);

  * or use a swing timer in order to periodically put your JFrame on the top :

         Timer tm=new Timer(1000, // every 1000 ms
             new ActionListener() {
                  public void actionPerformed(ActionEvent ev)
                  { wizardFrame.toFront(); }
             }
         );

0
 
LVL 92

Accepted Solution

by:
objects earned 400 total points
ID: 10837840
Use a JDialog and make your applet the dialog owner.

Frame owner = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, applet);
JDialog dialog = new JDialog(owner);
0
 

Author Comment

by:dkim18
ID: 10839149
     Timer tm=new Timer(1000, // every 1000 ms
             new ActionListener() {
                  public void actionPerformed(ActionEvent ev)
                  { wizardFrame.toFront(); }
             }
         );


 Webstorm,

This didn't work
------------------------

object,

Frame owner = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, applet);
JDialog dialog = new JDialog(owner);

what 'applet' does represent?


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 10839163
> what 'applet' does represent?

your applet instance.
0
 

Author Comment

by:dkim18
ID: 10839176
applet instance? sorry...i don't understand...
what do you mean by that?
0
 
LVL 92

Expert Comment

by:objects
ID: 10839193
i mean you JApplet object.
0
 

Author Comment

by:dkim18
ID: 10839434
Since this is an applet, how come there is an object?
All are worked in init().
0
 
LVL 92

Expert Comment

by:objects
ID: 10839473
> Since this is an applet, how come there is an object?

not sure what u mean, JApplet is a class, and your applet is an instance of that class.
0
 
LVL 92

Expert Comment

by:objects
ID: 10873915
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question