When I'm using JFileChooser
application in my program on Windows 7 it display such window:
But when I run the JWS File Chooser Demo it displays much better window:
Why?
When I'm using JFileChooser
application in my program on Windows 7 it display such window:
But when I run the JWS File Chooser Demo it displays much better window:
Why?
Because the demo doesn't use JFileChooser; it uses javax.jnlp.FileOpenService
, which uses the native OS's file dialog. The source code for that demo is here, check it out.
The major difference could be solved by using the native look and feel. See the main()
of FileBro for how to do that.
The Oracle Java Web Start app, is actually using the JNLP API instead of Swing's JFileChooser
.
Here is a link: http://download.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/jnlpAPI.html
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();
}