• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Different Swing Components on Windows and Solaris

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Desiree Rguez.
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Lionel Badiou
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Happy now?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Desiree Rguez.:
Happy now?



You have no idea. Thanks. We appreciate it.
 
no wonder he is so sad, he hasn't seen this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic