1

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!

Catalina Island
  • 7,027
  • 2
  • 23
  • 42
  • 1) JTabbedPane is solved in code by @aephyr, this code contruction is simpliest as is possible, 2) create a class implementing all required methods and put that to the UIManager directly, 3) Painter is method that fills Background (for example), this class could be wrote only once time for whole application and to use overloading for methods or properties, could be longer than examples on this forum but only one class for whole class or JVM, e.i. – mKorbel Jan 25 '13 at 13:56

1 Answers1

3
  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

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319