jhone
jhone

Reputation: 23

How can i change jtabbedpane selected tab background color

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

Upvotes: 2

Views: 2468

Answers (1)

Sachith Wickramaarachchi
Sachith Wickramaarachchi

Reputation: 5862

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

Upvotes: 3

Related Questions