Solved

need help, swing application problem with java help 2.0

Posted on 2006-07-13
4
330 Views
Last Modified: 2009-07-01
Does someone know what purpose's this code using for?

        javax.swing.UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());


My application using JDesktopPane to build MDI environments, if i put that code begin of my application (before show scrollpane app) my application worked without any error, but my application using javahelp to support help to user, when invoke help it throws error below

UIDefaults.getUI() failed: no ComponentUI class for: javax.help.JHelpContentViewer[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error

if i clear line javax.swing.UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader()); out of my application, javahelp working correct but if i create any JInternalFrame it show error like this :

UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JInternalFrame$JDesktopIcon[,0,0,0x0,invalid,hidden,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=]
java.lang.Error

Please show me what purpose of line : javax.swing.UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());

and how can i fix this problem, thanks
0
Comment
Question by:k6t
  • 3
4 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 17098072
k6t,
> javax.swing.UIManager.getLookAndFeelDefaults().put("ClassLoader",
> getClass().getClassLoader());

This line puts in the UIDefaults (which is a hashtable and you get it when you do javax.swing.UIManager.getLookAndFeelDefaults()) the classloader that renders the component you are using.

For a possible solution have a look here: http://javootoo.l2fprod.com/forum/viewtopic.php?topic=237&forum=1&10
0
 
LVL 35

Accepted Solution

by:
girionis earned 500 total points
ID: 17098102
You mainly need to try the last suggestion

"I fixed that problem in the main-method:


public static void main(String[] args){

File file = new File("/*the dir of the skinlf.jar*/");
URL url = file.toURL();
UrlClassLoader loader = new UrlClassLoader(new URL[]{url});
Thread.currentThread().setContextClassLoader(loader);
}"
0
 

Author Comment

by:k6t
ID: 17105164
hi, thanks for reply, but my application not using any another skin, it using default skin of swing, so in block of code you give me, which java file i need to put in that code? (replace skinlf.jar), thanks
0
 
LVL 35

Expert Comment

by:girionis
ID: 17106124
Hello, sorry I just saw your message, do you still have problem with the l&f?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now