user1967287
user1967287

Reputation: 11

Custom Components and Painter with Nimbus Look And feel

I am creating a look and feel that inherits from NimbusLookAndFeel and let me know how I can register my own components to use their custom Painter.

For example, a JButton like this ButtonPainter class used to be painted. Also would like to know how to register different states (for examples BACKGROUND_ENABLED, BACKGROUND_FOCUSED ...)

Can you lead me how I can do this? Actually I want to do is a custom tabbed pane and that this use their own Painter.

Edit: hmm I think I have not explained well.

I want to make a custom component, for example MyCustomTabbedPane, and this stylize from the look and feel that inherits from Nimbus. Can I register my own UI classes, for example MyCustomTabbedPaneUI making uiDefault.put("MyCustomTabbedPaneUI", new MyCustomTabbedPaneUI())?

How I can make my own UI class what logic should have this class?

And another question, how I to assign this class Painter, for example MyCustomTabbedPanePainter defining my own component states, as does Nimbus, such as BACKGROUND_ENABLED.

Thanks and Regards!

Upvotes: 1

Views: 1535

Answers (1)

mKorbel
mKorbel

Reputation: 109815

  1. preferred of ways, there are a few Look and Feels based on Nimbus

  2. another option, there are a few custom workaround for customize Nimbus Look and Feel, one of most complex is NimbusThemeCreator by @aephyr (imports for Java6???)

  3. hardiest of ways, have to create own xml file (see point 2nd.) and to override all keys for UIManager, everything on one place is UIManager Defaults by @camickr

  4. easiest of ways is to override only Primary Colors & Secondary Colors, then Colors are applied & valid for most of JComponents

  5. Renderers and Highlighter are separete issue, have to decide if by using standard or override this Keys too, for example XxxRenderer is preferred, in the case you override Nimbus UIDefaults and Renderer for concrete JComponent, then Colors are taken from Renderer not from UIDefaults

Upvotes: 3

Related Questions