Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

need help, swing application problem with java help 2.0

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
k6t
Asked:
k6t
  • 3
1 Solution
 
girionisCommented:
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
 
girionisCommented:
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
 
k6tAuthor Commented:
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
 
girionisCommented:
Hello, sorry I just saw your message, do you still have problem with the l&f?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now