Results 1 to 11 of 11
- 07-25-2011, 06:46 PM #1
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
Too-tall form with its head in the clouds (plural, not "The Cloud")
I have this code to center a form on the screen:
It works fine on my dev machine (XP), but on another (W2K), the top of the form is up out of sight, and I cannot reach the title bar to move it down or the close button to close it (Alt+F4 works, of course).Java Code:frame.setLocationRelativeTo(null);
What is my recourse? I don't want to reduce the height of the form...
- 07-25-2011, 07:04 PM #2
Is the window taller than the resolution of the screen?
You could get the resolution of the screen and set the location of the window based on that: Toolkit (Java Platform SE 6)
Or you could get the center point and do something similar: GraphicsEnvironment (Java Platform SE 6)How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 07-25-2011, 07:04 PM #3
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
I installed the same runnable jar file on another machine and, when I tried to run it, got "Could not find the main class"
What the deuce? These are all Windows machines; on one (the dev machine) it runs fine, on another it runs but also runs out of real estate, and on the third one it doesn't run at all. It reminds me of the problem Yogi Berra had with his catchers when he was managing the Yankees.
- 07-25-2011, 07:36 PM #4
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
Changing the resolution fixed it; one would think that if a portion of a form gets "cut off" it would be the bottom, not the top.
I'm still wondering why on the third machine it won't run at all. Maybe on out-dated version of the JVM is installed there? Would that [not] do it?
- 07-25-2011, 07:45 PM #5
You need to see if there are error messages.won't run at all
Open a command prompt, change to the directory with the jar file and enter:
java - jar THEJARFILENAME.jar
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
- 07-25-2011, 08:11 PM #6
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\JCP Associate>cd..
C:\Documents and Settings>cd..
C:\>cd misc
C:\Misc>java -jar jawa.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/jcp/tds/R
T_TCP_JCP_TDS_OO_State_SortSim (Unsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
C:\Misc>
- 07-26-2011, 12:08 AM #7
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
The documented behaviour of setLocaltionRelativeTo() is to center the window on the screen.one would think that if a portion of a form gets "cut off" it would be the bottom, not the top.
You have compiled for 1.6 but are running with an older runtime. (You can check this with "java -version")Unsupported major.minor version 50.0
- 07-26-2011, 03:56 PM #8
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
Yes, that's why I use it - I hate the default NW corner thing, as if the Java architects were chanting "Fifty-four Forty or Fight!" It makes me mad at the Brits all over again.
That's what I sussed. What's the best place to download the latest runtime? Just Google "Java runtime"?
- 07-26-2011, 04:05 PM #9
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 07-26-2011, 04:08 PM #10
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
- 07-26-2011, 04:47 PM #11
Senior Member
- Join Date
- Jul 2011
- Posts
- 100
- Rep Power
- 0
Similar Threads
-
My "form" is 9X uglier than a bag of butts (How to restrict the width of JTextField?)
By blackbird in forum AWT / SwingReplies: 5Last Post: 07-16-2011, 12:01 AM -
Not Getting "SourceURL" When content copied form browser using Clipboard java
By Anuj Oscar in forum AWT / SwingReplies: 5Last Post: 07-13-2011, 02:25 PM -
Help with "Head First Java" quiz
By TheWhopper in forum New To JavaReplies: 6Last Post: 06-04-2011, 06:09 AM -
How to change my form design from "metal" to "nimbus" in Netbeans 6.7.1?
By mlibot in forum New To JavaReplies: 1Last Post: 01-21-2010, 09:20 AM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks