0

I am using Nimbus L&F , JDK 1.7 and Netbeans 8.0.

I should customize Nimbus. However, when I run my project even without changing any code, some colors which I set by UIManager are changing.

This is where I set Nimbus;

try {
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (Exception e) {
            System.err.println("Some error");
}

Here is my painter example (darkpainter is the same with Color.Gray instead of Color.orange);

Painter orangePainter = new Painter() {

            @Override
            public void paint(Graphics2D g, Object object, int width, int height) {
                g.setColor(Color.Orange);
                g.fillRect(0, 0, width, height);
            }
        };

And I am customizing with these codes;

UIManager.put("control", Color.gray);
UIManager.put("nimbusBlueGrey", Color.gray.darker());
UIManager.put("nimbusBorder", Color.orange);
UIManager.put("TabbedPane:TabbedPaneTab[Disabled].backgroundPainter", darkpainter);
UIManager.put("TabbedPane:TabbedPaneTab[Disabled+Selected].backgroundPainter", orangePainter);
UIManager.put("TabbedPane:TabbedPaneTab[Enabled].backgroundPainter", darkpainter);
UIManager.put("TabbedPane:TabbedPaneTab[Selected].backgroundPainter", orangePainter);

I couldn't find the problem. I tried to use JDK 1.8 and Netbeans 7.3. I also tried to run from console directly but the same problem. Thank you for your help.

Emre
  • 79
  • 1
  • 11

1 Answers1

0

It has been a while since I have used Nimbus but if I recall correctly most of the Nimbus elements are not so easy to override using standard means.

I highly suggest you look up a Nimbus specific tutorial or guide on how to properly override colors/fonts/etc.

An answer to another question on stackOverflow has information relevant to yours and you should read up on it for further information.

Override Swing Nimbus L&F primary color per component instance

Community
  • 1
  • 1
MSB
  • 854
  • 7
  • 24