Solved

need help, swing application problem with java help 2.0

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 43
Java Timer (static) 9 36
Java Loop 6 50
oracle 11g 23 50
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

867 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

15 Experts available now in Live!

Get 1:1 Help Now