Solved

Making stay up frame when outside of frame clicked..

Posted on 2004-04-15
9
228 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 100 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Jpanels and Jframe 8 32
Opening PDF on button click and fill new document 2 35
tomcat startup error 5 59
Tomcat: Unable to run tomcat service. 2 18
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

785 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