473,573 Members | 3,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JFrame always on top

5 New Member
Whenever I run my GUI, the frame is pinned as the top window ALWAYS even though I never set it to be like that. I even added in setAlwaysOnTop( false) for good measure (it's default false, right?) and my frame is always on top regardless. Any clues?

Expand|Select|Wrap|Line Numbers
  1. public static void main(String[] args){
  2.          JFrame frame = new JFrame("Pearson Warranty");
  3.          frame.setResizable(false);
  4.          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  5.      frame.setAlwaysOnTop(false);
  6.          Dimension screenSize =
  7.                     Toolkit.getDefaultToolkit().getScreenSize();
  8.          frame.setLocation(screenSize.width/2 - (400/2),
  9.                     screenSize.height/2 - (400/2));
  10.  
  11.         // Get additional frame information
  12.          PearsonWarrantyGUIpanel mainPanel = new PearsonWarrantyGUIpanel();
  13.  
  14.          frame.getContentPane().add(mainPanel);
  15.          frame.pack();
  16.          frame.setVisible(true);
  17.       }
Jul 7 '08 #1
9 11800
Dököll
2,364 Recognized Expert Top Contributor
Hey there!

Try to set the frame's content Layout to adjust positioning.

Stay tuned if that does not help....
Jul 8 '08 #2
JosAH
11,448 Recognized Expert MVP
Hey there!

Try to set the frame's content Layout to adjust positioning.

Stay tuned if that does not help....
That surely doesn't help; @OP: what JVM (and version) are you running?

kind regards,

Jos
Jul 8 '08 #3
jrobinson3k1
5 New Member
That surely doesn't help; @OP: what JVM (and version) are you running?

kind regards,

Jos
1.5.0_15

and since I need to enter 20 characters I have written this line :P
Jul 8 '08 #4
JosAH
11,448 Recognized Expert MVP
1.5.0_15

and since I need to enter 20 characters I have written this line :P
Strange; my Java versions don't show that "always on top" behaviour and they
shouldn't; any chance for an upgrade? (1.6)

kind regards,

Jos
Jul 8 '08 #5
jrobinson3k1
5 New Member
Strange; my Java versions don't show that "always on top" behaviour and they
shouldn't; any chance for an upgrade? (1.6)

kind regards,

Jos
I'm also running this program on a Windows 98 machine if that has anything to do with it, but it shouldn't
Jul 9 '08 #6
jrobinson3k1
5 New Member
OK, well I fixed my problem...sorta . Check this out.

When I compile and run my program from command line the window ALWAYS stays on top (the problem I've been having).

Now, I condensed all my files into a jar file and poof! Problem has disappeared. I was planning on eventually making my program a java executable anyway, so as long as it works like this, then I'm happy. But its still odd that when I run it from command line the window is always on top.
Jul 9 '08 #7
JosAH
11,448 Recognized Expert MVP
OK, well I fixed my problem...sorta . Check this out.

When I compile and run my program from command line the window ALWAYS stays on top (the problem I've been having).

Now, I condensed all my files into a jar file and poof! Problem has disappeared. I was planning on eventually making my program a java executable anyway, so as long as it works like this, then I'm happy. But its still odd that when I run it from command line the window is always on top.
I find this a bit strange; it is as if the properties of the command window are
inherited by your JFrame; but then again, it shouldn't inherit those things.

What happens if you run your program from a command line window using either
java.exe and javaw.exe? The last one doesn't open another console while the
first one does so.

Or maybe it's MS Windows 98 itself ...

kind regards,

Jos
Jul 10 '08 #8
jrobinson3k1
5 New Member
So the problem seems to be with the Windows 98 console I suppose, because same problem with java, but problem gone with javaw.

Isn't it great how computers always make sense? >_<
Jul 10 '08 #9
JosAH
11,448 Recognized Expert MVP
So the problem seems to be with the Windows 98 console I suppose, because same problem with java, but problem gone with javaw.

Isn't it great how computers always make sense? >_<
Does running java.exe open a new console or is your java program just able to
print in the currently opened console? What does javaw.exe do when you run it
in an already opened console?

I'm afraid we have to point to MS Windows 98 for this all; I can't prove it because
I don't run that blasphemy of an OS.

kind regards,

Jos

ps. MS Windows: a 32 bit graphical shell for a 16 bit patch to an 8 bit operating
system, written for a 4 bit processor, developed by a 2 bit company that can't
stand 1 bit of competition ;-)
Jul 10 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3317
by: Tuno | last post by:
I'm relatively new to Java Swing programming. I have a console application that processes text files and while doing so I want to suspend the execution when an error is encountered that requires the user to make a choice. I want to do that with my own JFrame that allows the user to edit the bad data in a GUI and then click "Accept" or...
5
6846
Shinzon
by: Shinzon | last post by:
ok so far I have got: JFrame frame = new JFrame( "Matt's DVD's" ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setSize( 420, 170 ); // set frame size frame.setVisible( true ); // display frame JLabel label = new JLabel("Text Label");
5
6909
Shinzon
by: Shinzon | last post by:
Ok so I have been working on this for a moment now and wondering how to add multiple jlabels to a jframe. the code looks like this: JLabel jl = new JLabel("DVD ID #= " + dvd); //Displays DVD id JLabel j2 = new JLabel("Name of DVD = " + dvd); //Displays dvd name JFrame frame = new JFrame( "Matt's DVD's" ); //...
3
1806
by: coffeetime | last post by:
Hi, I just decided to learn java, so I'm quite a noob. I use the book learning java third edition. have JDK 1.6 program in notepad. I have made the simple HelloJava example, and now i wanted to make the one in the frame. but when i try to compile the .java file i get following error: C:\Program Files\Java\JDK1.6.0_05\bin>javac...
3
2408
by: coffeetime | last post by:
Hi, I just decided to learn java, so I'm quite a noob. I use the book learning java third edition. have JDK 1.6 program in notepad. I have made the simple HelloJava example, and now i wanted to make the one in the frame. but when i try to compile the .java file i get following error: C:\Program Files\Java\JDK1.6.0_05\bin>javac...
2
10598
by: zahit | last post by:
hi guys, my line doesn't appear on the frame. what's the problem? import java.util.*; import java.io.*; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; public class Operation {
6
13829
by: gaya3 | last post by:
Hi, I need to make the frame invisible on action event in swings. I have the following code: public class sample_pgm extends JFrame{ public void sample() { JFrame jf = new JFrame("Sample"); JPanel panel = new JPanel();
1
2528
by: Gimzo | last post by:
Hi, I'm trying to create a button that opens a new window for setting up a whole crapload of constants for an analysis program. For this, I have a JButton. The actionPerformed-method activates another method in the master class, which creates a new JFrame. The JFrame contains a JTable which has it's own TableModel, also residing within the...
1
6130
by: sibusiso | last post by:
HI Can anyone help with the scenario where where you have to pass a certain data from one JFrame to another. For example, suppose you have a JFrame is your main window you disabled your Jmenu and have an option of Login button and the login button calls another JDialog Class, say if Login() is true in Jdialog then enable JMenu on JFrame(Main...
0
7741
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7660
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7977
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6346
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3681
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2163
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1254
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.