aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Overriding the createPopup() of a Nimbus LAF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Overriding the createPopup() of a Nimbus LAF" Watch "Overriding the createPopup() of a Nimbus LAF" New topic
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: 825
    
    5

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: 39869
    
  28
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: 156
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overriding the createPopup() of a Nimbus LAF