Jfilechooser look better?

When I use the application JFileChooserin my program in Windows 7, it displays a window like this:

Metal JFileChooser

But when I run the JWS File Chooser Demo , it displays a much better window:

JWS File Chooser Demo

Why?

+3
source share
4 answers

Because the demo does not use JFileChooser; it uses javax.jnlp.FileOpenServicewhich uses the native OS file dialog. The source code for this demo is here , check it out.

+7
source

The main difference can be solved using appearance. For more information on how to do this, see main() FileBro .

yswnE.png

+5
source

Oracle Java Web Start JNLP API Swing JFileChooser.

Here is the link: http://download.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/jnlpAPI.html

+4
source

use this code

          try
        {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        }
        catch (ClassNotFoundException e1)
        {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        catch (InstantiationException e1)
        {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        catch (IllegalAccessException e1)
        {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        catch (UnsupportedLookAndFeelException e1)
        {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
0
source

All Articles