Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4662

Re: Setting JTabbedPane selected color

From "John B. Matthews" <nospam@nospam.invalid>
Newsgroups comp.lang.java.gui
Subject Re: Setting JTabbedPane selected color
Date 2011-08-27 04:07 -0400
Organization The Wasteland
Message-ID <nospam-AF938A.04070627082011@news.aioe.org> (permalink)
References <2488a5a5-932a-4817-9dc0-ffa3f02ec462@p37g2000prp.googlegroups.com> <nospam-B82CB4.14120822082011@news.aioe.org> <faec3d1a-37dd-4009-ad5b-150f73da0d7e@x21g2000prd.googlegroups.com>

Show all headers | View raw


In article 
<faec3d1a-37dd-4009-ad5b-150f73da0d7e@x21g2000prd.googlegroups.com>,
 Fred <fred.l.kleinschmidt@boeing.com> wrote:

> On Aug 22, 11:12 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> > In article
> > <2488a5a5-932a-4817-9dc0-ffa3f02ec...@p37g2000prp.googlegroups.com>,
> >
> >  Fred <fred.l.kleinschm...@boeing.com> wrote:
> > > I want to set the color of the selected tab in a JTabbedPane. I 
> > > use: UIManager.put( "TabbedPane.selected", color );
> >
> > > But this also sets the background of the navigation arrows (if 
> > > there are more tabs than can be displayed). How do I set only the 
> > > selected tab color without changing the button colors?  (Using 
> > > Java1.6)
> >
> > Can you use WRAP_TAB_LAYOUT for your tabLayoutPolicy? See also
> > TabComponentsDemo:
> >
> > <http://download.oracle.com/javase/tutorial/uiswing/examples/components/index.html>
> 
> My app may have many, many tabs. Wrapping is impractical - takes up 
> too much real estate.
> 
> A new problem: we are now using Nimbus Look-and-feel and the 
> statement UIManager.put( "TabbedPane.selected", color ); no longer 
> works. It merely sets the color of the navigation arrows (if they 
> exist), and does nothing to the selected tab.

I don't see "TabbedPane.selected" among the Nimbus defaults, but it 
looks like you have plenty of options. Apparently, you can even replace 
the relevant Painters:

<http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/info.html>
<http://www.jasperpotts.com/blog/category/nimbus/page/2/>
<http://jasperpotts.com/blogfiles/nimbusdefaults/nimbus.html>

I can't help but notice the similarity between the two interfaces:

<http://download.oracle.com/javase/7/docs/api/javax/swing/Painter.html>
<http://download.oracle.com/javase/7/docs/api/javax/swing/Icon.html>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Setting JTabbedPane selected color Fred <fred.l.kleinschmidt@boeing.com> - 2011-08-22 09:08 -0700
  Re: Setting JTabbedPane selected color "John B. Matthews" <nospam@nospam.invalid> - 2011-08-22 14:12 -0400
    Re: Setting JTabbedPane selected color Fred <fred.l.kleinschmidt@boeing.com> - 2011-08-26 07:14 -0700
      Re: Setting JTabbedPane selected color "John B. Matthews" <nospam@nospam.invalid> - 2011-08-27 04:07 -0400
        Re: Setting JTabbedPane selected color Fred <fred.l.kleinschmidt@boeing.com> - 2011-08-29 07:39 -0700
          Re: Setting JTabbedPane selected color "John B. Matthews" <nospam@nospam.invalid> - 2011-08-29 12:12 -0400
            Re: Setting JTabbedPane selected color Knute Johnson <nospam@knutejohnson.com> - 2011-08-29 16:52 -0700

csiph-web