Change color of disabled JTabbedPane

Hi everybody,
I have a disabled JTabbedPane and now I need to change the color of the text in the Tab.
Default it is a grey color.
I know you normally can do something like:
UIManager.set("ComboBox.disabledForeground", Color.red);But this isn’t working for a TabbedPane
Somebody has any suggestions?
Regards,
Remco

try this
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Testing extends JFrame
  public Testing()
    setLocation(300,200);
    setSize(400,250);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    final JTabbedPane tp = new JTabbedPane();
    tp.addTab("tab 1",new JPanel());
    tp.addTab("tab 2",new JPanel());
    tp.addTab("tab 3",new JPanel());
    getContentPane().add(tp,BorderLayout.CENTER);
    JButton btn = new JButton("Disable/Enable \"Tab 2\"");
    getContentPane().add(btn,BorderLayout.SOUTH);
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        tp.setEnabledAt(1,!tp.isEnabledAt(1));
        tp.setTitleAt(1,"<html><font color="+(tp.isEnabledAt(1)? "black":"red")+">tab 2</font></html>");}});
  public static void main(String[] args){new Testing().setVisible(true);}
}

Similar Messages

  • Change Color of Disable Tab in JTabbedPane

    Hello Friends,
    I have one JTabbedPane in my Application.
    In that one Tab is Disable.
    I want to change default Background and Foreground color of that tab.
    Can u help me...
    Thanks in Advance,
    Nishith Shah.

    hii,
    please I can't find out any DisableColor or something similair for defaultTabbedPaneUI, please try (unselect)
    package jtabs;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Insets;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    import javax.swing.plaf.ColorUIResource;
    public class TestTabbedPane extends JFrame {
        JTabbedPane tabbedPane;
        public TestTabbedPane() {
            tabbedPane = new JTabbedPane();
            tabbedPane.setPreferredSize(new Dimension(300, 200));
            getContentPane().add(tabbedPane);
            JPanel panel = new JPanel();
            tabbedPane.add(panel, "null");
            JTextField one = new JTextField("one");
            tabbedPane.add(one, "one");
            JTextField two = new JTextField("two");
            tabbedPane.add(two, "two");
            tabbedPane.setEnabledAt(2, false);
            /*UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
            UIManager.put("TabbedPane.highlight", new Color(255, 0, 0));
            UIManager.put("TabbedPane.lightHighlight", new Color(0, 255, 0));
            UIManager.put("TabbedPane.darkShadow", new Color(0, 255, 0));
            UIManager.put("TabbedPane.shadow",new Color(0, 0, 255));
            UIManager.put("TabbedPane.light" ,  new Color(0, 255, 0));
            UIManager.put("TabbedPane.foreground", new Color(0, 0, 0));
            UIManager.put("JTabbedPane.font", new Font("Dialog", Font.ITALIC, 12));
            UIManager.put("TabbedPane.selected", new Color(255, 0, 0));
            UIManager.put("disable", new Color(255, 0, 0));
            UIManager.put("TabbedPane.selectHighlight" , new Color(0, 0, 0));*/
            //UIManager.put("TabbedPane.background",  new Color(0, 0, 0));
            //SwingUtilities.updateComponentTreeUI(tabbedPane);
            /*tabbedPane.setTitleAt(2, "<html><font color=" +
                    (tabbedPane.isEnabledAt(2) ? "black" : "red") + ">" +
                    tabbedPane.getTitleAt(2) + "</font></html>");*/
        public static void main(String args[]) {
            TestTabbedPane frame = new TestTabbedPane();
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
    } value are from
    import javax.swing.*;
    import java.util.*;
    public class GetUIManagerList {
        public static void main(String[] args) {
            UIDefaults defaults = UIManager.getDefaults();
            System.out.println(defaults.size() + " properties defined !");
            System.out.println("-----------------------------------");
            String[] colName = {"Key", "Value"};
            String[][] rowData = new String[defaults.size()][2];
            int i = 0;
            for (Enumeration e = defaults.keys(); e.hasMoreElements(); i++) {
                Object key = e.nextElement();
                rowData[ 0] = key.toString();
    rowData[i][ 1] = "" + defaults.get(key);
    System.out.println(rowData[i][0] + " ,, " + rowData[i][1]);
    please could I ask camickr or DarrylBurke how to overide disabled label in JTabbedPane (without Shadows), with using their SwingUtils
    ... kopik                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Change color of disabled button

    Hello,
    how can i change the color of a "diabled and greyed" button? I customized the button with new pictures for the true and false-state. but when the button is disabled and greyed then its always the same color: grey.
    Is it possible to change this color somehow?
    Thx for oyur help

    NewOne wrote:
    The problem is not the reference.
    The problem is the reference. The 'Controls[]' property of the cluster outputs an array of general control references. To use these you have to cast them to the right type so you can use them like you want:
    Ton
    Message Edited by TonP on 09-26-2006 04:10 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    example2.png ‏3 KB

  • Images Change Colors between monitors while the UI stays the same

    Hey! Im having an issue where photoshop changes the colors when I move the window between my monitors, seen here: http://sta.sh/04y5s60vf3j This isnt due to the monitors themselves being different, it actually changes after a few seconds of moving it inbetween the monitors. The left one has been callibrated with a spyder 3 elite which I no longer have access to. I applied the file with windows color management instead of the spyder utility. The second one is new, and it is not callibrated by anything, but instead was done by hand with the built in brightness/contrast/custom RGB settings. Both of them are very close to eachother, enough so for my tastes. but when photoshop changes what the image looks like, it's causing problems. Interestingly enough, when I disable callibration for the monitor on the left, the image does not change colors between monitors, but instead always appears as it does on the right. but then they don't match up and the whole screen looked washed out because it's uncallibrated, so that doesnt do me any good. Another interesting thing to point out, is when this image is saved as a .JPG, and viewed with firefox the image appears exactly like the monitor on the LEFT (which is my main monitor) despite the left monitor being the one that is force changed. does anyone have any suggestions? It also appears that windows photoviewer is behaving the same way, though firefox does not. Meaning when I open an image in all 3 on the left monitor, they look the same, but when opened on the right monitor, windows photo viewer and photoshop both display the image as brighter and redder than firefox does. This is frustrating, because it seems photoshop is changing the image with my callibration on my left monitor to match what it looks like on the web, which it does. but it doesn't do this for the right monitor, or when the left is uncallibrated. Another issue I can see with this is even if the UI is the same shade of gray, the images are different between the monitors because of this change. Does anyone have any suggestions?
    - BD

    Alright! So I reread through all this, poked at some things on the internet, and I'm going to attempt to summarize what would be a good solution for all this (And it seems, it still won't be perfect, but to get myself into the best environment I can for not messing with images for an hour trying to make them look nice before I post them to the web. I painted something yesterday on the cintiq, popped it over to my laptop screen and it just looked washed out and terrible.)
    1. Get a X-rite EODIS3 i1 Display Pro, Callibrate laptop and cintiq. I do have the money to drop on something like this, especially if it's a time saver.
         Things I'm not sure about:
              a. There was a ton of complaints about the software not working when I checked reviews, but also a ton that said everything was great. most of them were mac users though.
              b. I'm not sure if problems would still be posed, even while calibrated, by me having a wide gamut monitor.
              c. I'm a terrible excuse for a human being and I think the colors showing up brighter on the wide gamut screen is pretty (I should just make my images this bright on a normal screen and there won't be any issues. >.>)
    2. Set Firefox to color manage (easy enough)
    3. Change my photoshop working space to sRGB (since they'll have been calibrated at this point)
    3. Accept the fact that most of the people who look at my work will be doing so on a monitor that is almost certainly uncalibrated, and I can't control what they will see on my screen, but I CAN control if the colors are -actually- what I want them to be on any properly calibrated device. which is probably the best way to go anyways.
    4. Make paintings, have fun.
    Now, you two have been going on about all sorts of interesting things in here, and it seems that calibration issue run much much deeper than I ever thought. Do either of you have recommendations for how I should tweak this list of things to do or other things I can/ should do? I'm not currently a working professional, but if I have anything to say about it, I will be within a few years (I'm going to school for illustration and studying concept design on my own time) so it'd be useful for me to get into good habits now.
    - Brendavid

  • Change colors to all components in a consistent way

    Is there a way to change color to all components of an application (or of a JFrame), such as all JButtons backgrounds, JFrame backgrounds etc.?
    I suppose i've to deal with UIManager defaults, but is there some facility, or some check-list to help achieve this task?.
    Thanks in advance
    Agostino

    Check out my ComponentMapper class. You could do it with this by running the mapper on the contentpane (and potentially the JMenuBar too if you like)
    You are welcome to use and modify this code but please don't change the package or take credit for it as your own work
    tjacobs.util.ComponentMapper
    ======================
    package tjacobs.util;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.TextComponent;
    import javax.swing.JFileChooser;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    import javax.swing.event.DocumentEvent;
    import javax.swing.event.DocumentListener;
    import javax.swing.text.JTextComponent;
    public class ComponentMapper {
         public static interface MappedFunc {
              public void func(Component c);
         public static void map(Component c, MappedFunc func) {
              func.func(c);
              if (c instanceof Container) {
                   Container con = (Container)c;
                   int count = con.getComponentCount();
                   for (int i = 0; i < count; i++) {
                        map(con.getComponent(i), func);
         public static void main(String[] args) {
              JFileChooser fc = new JFileChooser();
              MappedFunc mf = new MappedFunc() {
                   public void func(Component c) {
                        if (c instanceof JTextComponent) {
                             System.out.println("found");
                             final JTextField tf = ((JTextField)c);
                             tf.setEditable(false);
                             tf.getDocument().addDocumentListener(new DocumentListener() {
                                  public void insertUpdate(DocumentEvent de) {
                                       Runnable r = new Runnable() {
                                            public void run() {
                                                 tf.setText("");
                                       SwingUtilities.invokeLater(r);
                                  public void removeUpdate(DocumentEvent de) {
                                  public void changedUpdate(DocumentEvent de) {
                             while (c != null) {
                                  System.out.println(c.getClass());
                                  c = c.getParent();
                             //disable the textfield
              map(fc, mf);
              fc.showSaveDialog(null);
    }

  • Change colors, in detail

    I found that selecting a high contrast Theme is the only way to change some details of each of the different colors (Hyperlinks, Disabled text, Selected text, etc.) of a window.  When a high contrast screen is selected, I can search for "change
    color" and select "change the color of your taskbar and window borders" and I'll get to a "Color and Appearance" screen that is not available for any non-high contrast theme.  However, even this added ability to customize the
    screen colors falls far short of complete control.
    My custom Yahoo! page looses the text coloration differences to show stocks that are going up (green) vs. going down (red).  I also seem to have very little control of Outlook coloration.  As I am on my PC for most of every working day, I need
    the ability to provide good contrasting colors on all my window screens.  I am disappointed that Microsoft has not fine tuned this feature by now.  Most everything else about 8.1 I like quite a bit.
    William Fearn

    You're no longer allowed to customize the colors to the extent you used to be able to do so.  Microsoft has reduced our ability to make the desktop easier to use by configuring or "theming" it with something more pleasing than the (IMO)
    fairly broken theme they provide.  I personally find the loss of drop shadows tremendously reduces utility.
    I believe it's a plot by Microsoft Marketing to try to get people to dislike using the desktop so that they can get more support for Metro/Modern. 
    It ain't working!
    There are folks who have figured out how to "hack" the OS to enable better theme support, and one who's even re-implemented the Aero Glass effects.  Some of them hang out at
    msfn.org.  These things can be employed to make it easier on the eyes (I've managed some improvement).
    As far as Outlook 2013 / 365 goes...  There's little hope, since even a theme replacement doesn't affect it.  The Office team rolled their own UI, probably to help their Marketing department out.  On the Microsoft forum elsewhere
    is
    a thread with something like 700 responses from people who claim their eyes are bleeding from trying to use the latest version of Office.  Most claim Office 2010 was far better.
    Here's the really disturbing part:  Microsoft isn't releasing stuff by accident.  They're actively making the desktop harder to use - on purpose.  And their marketing is trying to turn it into an "Emperor's New Clothes"
    situation with concepts/terms like "digitally authentic" and "skeuomorphism is bad".
    Yes, it stinks for those of us who work with the desktop day in and day out.  You're not alone.  But you won't find many folks who'll stand up and agree with you, because pragmatism is not
    fashionable.
    -Noel
    Detailed how-to in my eBooks:  
    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

  • Changing color temperature / MSI GT780R ??

    Hi ...
    I want to change color temperature (white balance)  >>> en.wikipedia.org/wiki/Color_temperature <<<
    I hope you Understand what i mean .... It about how warmer or cooler is the color of the screen ...
    my laptop
    MSI GT780R
    i7-2630QM
    GTX 560M 1.5 GB
    16 GB RAM
    Thanks ...

    If this is only happening in Firefox then try to disable hardware acceleration in Firefox.
    You can try to disable hardware acceleration in Firefox.
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    You need to close and restart Firefox after toggling this setting.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    *https://support.mozilla.org/kb/upgrade-graphics-drivers-use-hardware-acceleration

  • Moving a rectangle or change color in "Run-Time "?

    First step, the objects of decoration you can modify its properties in "Run-Time "?
    Moving a rectangle or change color in "Run-Time "?
    I want to develop a mini SCADA application, where I have to do some animations usingsimple objects like Shapes.

    Yes, it is possible to modify decorations in runtime. An example is below.
    As you can see, you just need to get a reference to the front panel containing the decoraitions, and then use the Decos[] property to get an array of references to the decorations. These can be passed to a property node.
    Unfortunately, the decorations cannot be given a unique identifier, such as a label. So if you have multiple decorations, it can be tricky to modify the properties of a specific one. If you are only dealing with one shape, this won't be an issue. One roundabout way to pick out a particular decoration would be to search through the array references until you find the one with matching size and location on the front panel. Alternatively, you could use a disabled control, such as a boolean push button with no caption, and refer to that directly.
    Hope this helps.
    -Garrett

  • Visited links no longer change color?

    my visited links in  search have suddenly stopped changing color? how to get back to color after visiting?

    I had this problem (or similar). Links changed color as I clicked them, but if I reload the page with all the links, they're all back to "unclicked". None of the above fixes helped.
    Things started behaving properly after I disabled all add-ons (and removed ones that were outdated), then re-enabled them one at a time. I can't get the problem to reoccur, so I don't know exactly what add-on was causing it.

  • I have update to iOS 8.1.3, and I cannot open both centers, or use and cancel apps, or the screen change color to gray, or the display do not recognise that I touch it, and more. If I restart it, I find another mistake in next five hours.Help me pls.

    I have update to iOS 8.1.3, and I cannot open both centers, or use and cancel apps, or the screen change color to gray, or the display do not recognise that I touch it, and more. If I restart it, I find another mistake in next five hours. Help me please.
    iOS 8.1.3
    iPhone 5s 32 GB
    CPU 64 bit

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.0.1. For the iPad Mini the iOS is 6.0.2. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • Change color of AfCommandButton

    Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660
    Hello,
    i want to change the Color of a single button. I have this code in MySkin.css:
    .AFButtonBackground:alias{
    background-color: Purple;
    color: Aqua;
    But it changes color all the buttons. how to change the code? Can someone help me plaes?
    Thanks in advance
    Edited by: NewBB on 04-Nov-2010 06:29

    If the state of your button is different from the normal enabled state, then you should use one or more of the standard pseudo-classes :active, :busy, :disabled, :disabled:active, :hover or :hover-target, for example:
    af|commandButton.PurpleButton af|commandButton:disabled {
      background-color: Purple;
      color: Aqua;
    }Look at this great article for hints how to investigate what happens and what the correct selectors are:
    http://technology.amis.nl/blog/5722/using-adf-faces-11g-skinning-for-setting-the-styles-of-specific-component-instances-or-groups-of-instances
    Dimitar

  • How do I keep the visited hyperlinks from changing color?

    I am looking to keep the colors of visited sites, the same as unvisited chosen by the hosting site. For example; when I visit eBay, their hyperlink colors are different depending on location. They are black in the far left, and do not change color when visited. However, the hyperlinks in the center are blue, then change to purple after they are visited. I would like for the hosting site to use their own colors, but not differentiate from the unvisited links to the visited ones.
    I know I can change the color of the visited links to be the same as the non-visited links(FF>Options>Content>Colors>"change"Link Colors), but this is not what I am trying to achieve. When I do that, ALL links are my chosen color, even the links on the far left on the eBay page. Any help would be appreciated. Thank you

    Hi raven0, I'm not seeing this issue on Craigslist, although we're probably in different cities.
    Does this occur on other sites as well, such as search engine results? If so, it could indicate that Firefox isn't saving history for those page loads. You could check the Library dialog and see whether the individual pages are listed. Either:
    * Ctrl+Shift+h
    * History > Show All History
    If there's no history for those page loads, is it possible that the pages are being opened in private windows, or that history has become disabled in some other way?

  • Turning Buttons Off & Changing Color

    I have 9 buttons at the top mf my scene that play 9 movie clips, but when you arrive at the clip and click the button again it replays the clip, which I don't want it to do.
    For example, in many sites you will notice that when you arrive at a page, the button that took you there becomes unclickable while you are at that page and usually changes color.  Is there anyone who can please give me the code (AS3) to temporarily disable the button and have it remain on the "down" frame until the user navigates away?  Thank you.

    What you should be able to do is set the mouseEnabled property to false for the button.  If it is a SimpleButton object, and you are using AS3, you can set the upState to equal the downState....  btnName.upState = btnName.downState;
    You might also consider dimming the button instead of juggling the states by setting its alpha property to something < 1.

  • Why do I get a program error when changing colors?

    I get a 'Could not complete your request because of a program error' when I try to change colors on both the forground/background palette or from the color picker palette.  Is there a patch for this?
    I am using Photoshop CS6 version 13.0.1.x64

    Hi. Because this forum is for beginners trying to learn the basics of Photoshop, I'm moving your question to the Photoshop General Discussion forum.

  • Can anyone tell me why a picture would change color when I try to download/upload it?  It is the exact same picture- chosen the same way and when it goes to any other program it changes the color (I've tried canvas on demand and mpixpro.  I've also tried

    Can anyone tell me why this picture changes color when I try to download/upload it?  It is the exact same picture I have taken from the same location.  The image on the left is via preview and the image on the right is what is shows like when I try to download it.  I have emailed it to myself and it shows fine on the computer and in CS4, but when I look at the download via my phone or on another computer it shows the wonky color on the right.  I have checked the color space shows RGB/8 bit.  Any ideas why or how to fix it?  It isn't with any one specific session.... and I've tried it on both my desktop and my laptop- saved image to an external hard drive and to drop box.  I've tried sending the image to canvas on demand, my email, mpxipro, POST editing- all the same result.  Please HELP!!  What am I doing wrong?

    Most of the time you see something like that. The image in question has a color profile other then sRGB. Some image viewers/displayers are color managed and others are not.  So the image do not look the same in all of the applications you use. So colors seem to change.
    Try converting it to sRGB color and see if then looks the same all around. Also I think PC and Mac displays are set to different gamma something like 1.8 and 2.2
    Though I'm colorblind I even see color variations.

Maybe you are looking for