2

I tried most of the things to do this,using helps from this site,there have more related post about this question,but any of that questions not helped to me.

enter image description here

I need to change jtabbedpane selected tab background color.i used this code to that,but nothing will happen

import java.awt.Color;
import javax.swing.UIManager;

public class TestTabcolor extends javax.swing.JFrame {


    public TestTabcolor() {
        initComponents();
        UIManager.put("TabbedPane.selected", Color.Red);
    }

    public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TestTabcolor().setVisible(true);
            }
        });
    }

}

can anyone tell me how can i change selected tab color :) Thank you

Update: please don't set this question as duplicated,because that related questions not solved my problem

ChrisB
  • 2,497
  • 2
  • 24
  • 43
jhone
  • 23
  • 5
  • Possible duplicate of [Set the Background Color for JTabbedPane](http://stackoverflow.com/questions/2445565/set-the-background-color-for-jtabbedpane) – MordechayS Nov 20 '16 at 16:42
  • If you don't think your question is a duplicate, you could explain how it differs. – Robert Nov 20 '16 at 16:52
  • @Robert http://stackoverflow.com/a/2512232/7185884 i tried this solution also,but its not work, – jhone Nov 20 '16 at 16:57

1 Answers1

3

Call this UIManager.put("TabbedPane.selected", Color.Red); before initComponents();

Sachith Wickramaarachchi
  • 5,546
  • 6
  • 39
  • 68