Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Making stay up frame when outside of frame clicked..

Posted on 2004-04-15
9
236 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
tomcat not starting 6 64
use lov values 2 61
type mismatch (Object[] to double[] 4 33
ejb on wildfly 5 30
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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…

808 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