• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overriding the createPopup() of a Nimbus LAF

 
Geoff Berl
Greenhorn
Posts: 24
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read CarefullyChooseOneForum. This is a topic for the Swing subforum.

Good luck with the question!
 
Geoff Berl
Greenhorn
Posts: 24
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic