| Author |
Overriding the createPopup() of a Nimbus LAF
|
Geoff Berl
Greenhorn
Joined: Apr 13, 2011
Posts: 24
|
|
I am borrowing some code I found on the web that shows how to create a combobox with an embedded JTree. I am having an issue because I would like to use the Nimbus LAF but currently the code only has a custom class to handle the Metal, Windows and Motif LAFs. Is there any way to add code to do this for the Nimbus LAF?
I did some searching on the web but I keep coming back with results showing how to change the colors and fonts for Nimbus.
Here is the method overriding the updateUI() of the JComboBox
And here is the custom LAF classes to return a custom PopUp
Here is a link to the actual site with the source code: JTreeComboBox
|
 |
Geoff Berl
Greenhorn
Joined: Apr 13, 2011
Posts: 24
|
|
Actually, I just made a step forward. While snooping around in the API I found that Nimbus uses SynthComboBoxUI which extends BasicComboBoxUI. That being said, I added
and
Now it actually shows the full tree in the drop down (Before it was only showing one line, it wasn't adjusting the combobox size to the size of the JPopup) but my JTreeComboBox looks like a JLabel. Somehow my popup messed up that portion of the display, I'm not sure what element that is. I'll keep working on it.
|
 |
Kemal Sokolovic
Bartender
Joined: Jun 19, 2010
Posts: 792
|
|
Please read CarefullyChooseOneForum. This is a topic for the Swing subforum.
Good luck with the question!
|
The quieter you are, the more you are able to hear.
|
 |
Geoff Berl
Greenhorn
Joined: Apr 13, 2011
Posts: 24
|
|
Kemal Sokolovic wrote:Please read CarefullyChooseOneForum. This is a topic for the Swing subforum.
Good luck with the question!
Sorry, a few times I've posted in other forums I've been told to post in the beginner forum. I guess I'm not sure where the line is between beginner or a specific topic yet.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32638
|
|
|
Dom’t worry. We all get confused about which forum to use. There will be no confusion about which forum this post is in, either. Just click on the post and you can tell from the header and footer.
|
 |
m Korbel
Ranch Hand
Joined: Jun 19, 2012
Posts: 69
|
|
1. linked code is very old ...
2. have to override NimbusDefault rather than bothering with BasicXxxXxx / Plaf
3. for Popup (Window) have look at Nimbus Painter, override proper method(s)
4. XxxRenderers havenot (by default) any issue with Colors and Borders and quite good to ignore current theme or most of settings in UIManager (Nimbus L&F)
4. Nimbus is crazy for L&F customizations, there are custom L&F based on Nimbus, change its Color theme if is needed
5. search for xml files contains Keys for Colors, XxxUIResources e.i.
|
 |
 |
|
|
subject: Overriding the createPopup() of a Nimbus LAF
|
|
|