Java 1.6.0_51 and Java 1.7.0_25 Swing Applications fail with Webstart

1.1k views Asked by At

we are using PlasticLookAndFeel from JGoodies in the Version jGoodies-looks 2.2.2. I know this Version is not new, but we also tried it with the current Version of JGoodies, which didn´t help.

Since updating to Java 1.6.0_25 or 1.7.0_25 we have several problems, we cannot solve.

Some sample Effects are:

Stack Trace:
null
javax.swing.JFileChooser.isTraversable(Unknown Source)
javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)
javax.swing.JFileChooser.<init>(Unknown Source)

or: small-JDialogs with no visible and non resizable content

We have also tried to centralize our calls to UIManager.setLookAndFeel(xx) and put it in the EDT-Thread, but that didn´t solve the problem. (How does Java for OS X 2013-004 affect (break) Swing applications?) If we delete these calls, everything works fine with MetalLookAndFeel.

The problem only comes with:

  • Java 1.6.0 Update 51 or Java 1.7.0 Update 25
  • Java Webstart
  • Non-standard look and feels

We would be very happy if someone knows a solution or can help us with some tipps.

Thanks.

1

There are 1 answers

2
Bernhard Kern On

we solved the problem. It was a ClassLoading-Problem that only occurs with Webstart.

An easy Workaround is:

  • Start Application with Webstart-Console (Java -> Extended -> Java Console).

A solution is:

  • Add a different ClassLoader to UIDefaults in your LookAndFeel-Method initComponentDefaults().

You can do it like this:

protected void initComponentDefaults(final UIDefaults table) {
    table.put("ClassLoader", LookUtils.class.getClassLoader());
{

or

protected void initComponentDefaults(final UIDefaults table) {
    final Object[] lookAndFeelDefaults = {"ClassLoader", LookUtils.class.getClassLoader()}
    table.putDefaults(lookAndFeelDefaults);

{

It is also recommended that you set your look and feel in AWT-Event-Dispatcher-Thread.

javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
    @Override
    public void run() {
  try {
           javax.swing.UIManager.setLookAndFeel(applicationLookAndFeel);
  } catch (Exception e) {
     e.printStackTrace();
  }
    }
});

The NullPointer in the original post was caused by a missing Icon which could not be loaded with the standard classloader.