Solved

need help, swing application problem with java help 2.0

Posted on 2006-07-13
4
324 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresSpecial  challenge 13 42
What is JNDI datasource in spring 1 39
for i loop in grovy 1 34
Systems talking to each other 5 110
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

743 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

9 Experts available now in Live!

Get 1:1 Help Now