Results 1 to 8 of 8

Thread: Java app ugly under Ubuntu

  1. #1
    Join Date
    Jun 2006
    Beans
    24

    Java app ugly under Ubuntu

    Hey guys,

    I'm playing with Swing components in Java. I noticed that my Java application (that is using system L&F according to Sun's tutorials) doesn't look quite like other Java applications that I have installed (it's somewhat... ugly). For comparison, I've attached a screenshot comparing my Java app and Azureus.

    Why is that so?

    This is the code that I used for setting L&F:

    Code:
    		try {
    			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    		}
    		catch (UnsupportedLookAndFeelException e) {
    			
    		}
    		catch (ClassNotFoundException e) {
    		
    		}
    		catch (InstantiationException e) {
    			
    		}
    		catch (IllegalAccessException e) {
    			
    		}
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2007
    Location
    Waterloo, Ontario
    Beans
    227
    Distro
    The Feisty Fawn Testing

    Re: Java app ugly under Ubuntu

    Why do you think its ugly compared to the other one... you only have 2 menu items

    So the only things I can compare is File and Help, and the only difference between yours and the other is that they have hotkeys for F and H, maybe if you put those in it will look the same

  3. #3
    Join Date
    Sep 2006
    Location
    Brisbane, Australia
    Beans
    44
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Java app ugly under Ubuntu

    Azureus uses the swt for its widgets whereas your one appears to just use the normal swing widgets. Swing, as far as I know, doesn't like gnome very much.

  4. #4
    Join Date
    Feb 2007
    Location
    Waterloo, Ontario
    Beans
    227
    Distro
    The Feisty Fawn Testing

    Re: Java app ugly under Ubuntu

    what are the pros and cons of using swt over swing?

    I mean on all OS's, not just linux

  5. #5
    Join Date
    Sep 2006
    Beans
    399

    Re: Java app ugly under Ubuntu

    Do you have jdk6? this one makes apps look native in gnome.

  6. #6
    Join Date
    Jan 2006
    Location
    Leuven, Belgium
    Beans
    3,414

    Re: Java app ugly under Ubuntu

    Install jdk6 and add this to your ~/.bashrc:
    Code:
    export _JAVA_OPTIONS="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"

  7. #7
    Join Date
    Nov 2005
    Location
    Sweden
    Beans
    257
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Java app ugly under Ubuntu

    Quote Originally Posted by Ramses de Norre View Post
    Install jdk6 and add this to your ~/.bashrc:
    Code:
    export _JAVA_OPTIONS="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
    HOWEVER!, GTKLaf is quite slow and buggy still. Alot better than the old ones but still not good enough. Also not all applications will like GTKlaf and might not work, that's why making it the default isn't too good.

  8. #8
    Join Date
    Jun 2006
    Beans
    24

    Re: Java app ugly under Ubuntu

    Thanks for the replies everyone, yes, I was using JDK 5.0. So in order to get the right looks, I'll have to update to 6.0 or switch to SWT.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •