Re: cobbling a ComboBox
- From: Daniele Futtorovic <da.futt.news@xxxxxxxxxxxxxxx>
- Date: Wed, 25 Jun 2008 03:50:31 +0200
On 2008-06-24 14:42 +0100, Albretch Mueller allegedly wrote:
(new javax.swing.JComboBox()).getUI() I causing a NP Exception
~ sh-3.1# javac DanieleFurttorovic00.java
sh-3.1# java DanieleFurttorovic00
UIDefaults.getUI() failed: no ComponentUI class for:
javax.swing.JComboBox[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,
flags=16777224,maximumSize=,minimumSize=,preferredSize=,isEditable=false,
lightWeightPopupEnabled=true, maximumRowCount=8,selectedItemReminder=One]
Mind the package directory structure.
Note the package declaration in the code I posted:
package scratch;
This is important for the following line to work:
UIManager.put("ComboBoxUI", "scratch.Test$CustomMetalComboBoxUI");
(the runtime will try a Class.forName(String) with the value of that entry).
You need a directory X. Then you need the code in
X/scratch/Test.java
go to directory X, compile. Run *from that directory* using
"java -cp . scratch.Test"
This should work.
Since you weren't able to resolve that error on your own, I assume there
will be at least some things in that code you might not understand.
Please, try to figure them out (GIYF). Don't simply copy and paste code.
It would be nigh-worthless that way. I won't give you an overall
explanation, but if you come back at me with specific points, I'll try
my best to lay them out.
Always read the JavaDocs:
<http://java.sun.com/javase/6/docs/api/>
Check the SUN tutorials:
<http://java.sun.com/docs/books/tutorial/reallybigindex.html>
--
DF.
to reply privately, change the top-level domain
in the FROM address from "invalid" to "net"
.
- Follow-Ups:
- Re: cobbling a ComboBox
- From: Daniele Futtorovic
- Re: cobbling a ComboBox
- References:
- cobbling a ComboBox
- From: Albretch Mueller
- Re: cobbling a ComboBox
- From: Daniele Futtorovic
- Re: cobbling a ComboBox
- From: Albretch Mueller
- Re: cobbling a ComboBox
- From: Daniele Futtorovic
- Re: cobbling a ComboBox
- From: Albretch Mueller
- cobbling a ComboBox
- Prev by Date: Re: can't listen to TextArea of Spinner
- Next by Date: Re: cobbling a ComboBox
- Previous by thread: Re: cobbling a ComboBox
- Next by thread: Re: cobbling a ComboBox
- Index(es):
Relevant Pages
|