aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Different Swing Components on Windows and Solaris Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Different Swing Components on Windows and Solaris" Watch "Different Swing Components on Windows and Solaris" New topic
Author

Different Swing Components on Windows and Solaris

Desiree Rguez.
Greenhorn

Joined: Jun 08, 2005
Posts: 6
Hello,

I made an swing application. I developed it on Windows and it works and looks fine, but when I run it on Solaris it works fine but the swing components doesn't look the same. The JButtons have a different size (smaller). Does anyone know why this is happening or how to fix it?


Thank yo very much.

(I've been told that it's because of the font but I use icons in the buttons)
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
Hello,

It sounds like your application uses the system look and feel (this means that components will be drawn on screen as close as possible to platform components).

You migh try to set manually the look and feel to the cross platform one (also know as java look and feel).

See here for details.

Hope that helps,


Lionel Badiou
CodeFutures Software
Desiree Rguez.
Greenhorn

Joined: Jun 08, 2005
Posts: 6
Yes I'm using the system look and feel (I think, because I don't specify it anywhere)

By Java Look and Feel you mean Metal Look and Feel?


thank you very much for answering.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

It could be also that you are not using a layout manager and are positioning all your components statically with setBounds(). Different OS's compute pixels differently and so that would explain why your buttons, etc are not the same size. Layout managers will help eleviate that.


GenRocket - A Test Data Generation Platform
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
Hi again,

Java l&f is the default l&f used when no other l&f is specified, either on command line, code, or swing.defaultlaf property.

In your case, the swing.defaultlaf property is propably different on Windows and Solaris platform.

(As far as I know, the java look and feel was indeed also called 'metal' until java 1.4)

Best regards,
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

And now on to some business...

drf, we don't have too many rules around here but we do have a Naming Policy. Please adjust your display name accordingly.

Thanks and welcome to Javaranch.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Originally posted by Lionel Badiou:
Hi again,

Java l&f is the default l&f used when no other l&f is specified, either on command line, code, or swing.defaultlaf property.

In your case, the swing.defaultlaf property is propably different on Windows and Solaris platform.

(As far as I know, the java look and feel was indeed also called 'metal' until java 1.4)

Best regards,


The default look and feel until 1.5 is metal. In 1.5 it's ocean.
Desiree Rguez.
Greenhorn

Joined: Jun 08, 2005
Posts: 6
Can't be the layout null, I'm using Gridbaglayout and components appear in their right positions, it's just sizes (JButtons appear smaller and JTextFields bigger than they should).

I'll try the Look&Feel, thank you very much guys !





(I changed my name)
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Originally posted by Desiree:
(I changed my name)


Yes you did, and you are almost there. Notice anything different about my display name and yours? You need a first and last name. We realize that not everyone in the world has both a first and last name but we still require it. If you don't have one it's ok to make one up as long as it sounds real and you don't publically state that it is fake.
Desiree Rguez.
Greenhorn

Joined: Jun 08, 2005
Posts: 6
Happy now?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Originally posted by Desiree Rguez.:
Happy now?


You have no idea. Thanks. We appreciate it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different Swing Components on Windows and Solaris
 
Similar Threads
Mnemonics not working in Unix
Get the text marking right in JTextPane?
host com components in solaris platform
Cannot select textbox after drop down
How to Set Properties in OracleDataSource?