This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Swing Buttons visible in Linux but not Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing Buttons visible in Linux but not Windows" Watch "Swing Buttons visible in Linux but not Windows" New topic

Swing Buttons visible in Linux but not Windows

juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
My java swing application shows it's Buttons nicely on my Linux System (where I developed it).
Then I transferred the app. via jar-file to Windows98.
There the labels are displayed but not the Buttons.

Any idea what could be the cause?
Thank you!
Joe Ess

Joined: Oct 29, 2001
Posts: 9191

Jeez, what DOES run on Win98 correctly?
Seriously, the first thing you should check is the version of your JVM. If you have different versions you may be running into some bug/feature which was fixed/implemented between the versions.
If that's not the problem, try to create a simple test case which exhibits the behavior and post it.

[How To Ask Questions On JavaRanch]
Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 156

I found the same problem.

I am working on linux but my JVM was different in Win98.

When i installed the same jdk as was in linux, it work out.


Love is GOD and GOD is Love.
Anand Karia
IT Concretor.......
M/s. Anand Karia Concreting IT
juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
Thank you for your suggestions, Joe and Anand.

Meanwhile I found out the cause (I post it for everybody else
encountering a similar feature):

I had set the screen size explicitly (as opposed to using frame.pack())
and also used the method BorderFactory.createEmptyBorder() with
fixed numbers (for distance from top, left, bottom, right) for some
gui elements.

On a screen having height=1024, width=1280 the gui looks fine,
but on a screen having height=768 and width=1024 my buttons got
invisible because of the fixed createEmptyBorder: the
given numbers were too high on a smaller screen.

(By the way: this is how to find out the user's screen size

Using frame.pack() made the buttons visible again, or,
using different numbers for creating empty borders for
different screen sizes.
(How to solve this in a elegant way is a different chapter, though)
I agree. Here's the link:
subject: Swing Buttons visible in Linux but not Windows
It's not a secret anymore!