🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10138

Re: L&F primary colors

#10138
From: Ronen
Date: Wed, 10 Nov 1999 00:00
79 lines
3716 bytes
Your solution seem to be what I looked for, but its still doesn't work for
me
I tried exactly what you have suggested except that I'm doing an application
and not an applet.
I still have the gray and purple colors of the default Metal Theme.
I extended the DefaultMetalTheme instead of MetalTheme class (because its
abstract and some methods need to be implemented)
Any other suggestions or clarifications for this solution?
Thanks again Ronen.

Johan Forsberg <jfo@SPAM_SPAM_EGGS_SPAMstmf.se> wrote in message
news:80bdhh$6sl5@forums.borland.com...
>
> Ronen <ronenm@netvision.net.il> skrev i
> diskussionsgruppsmeddelandet:8098vf$j5511@forums.borland.com...
> > Hi
> > I'm using MetalLookAndFeel
> > Does anyone knows how can I change the primary colors
> > (ScrollBars, Selected items background, splitters, etc..)
> > Thanks Ronen
>
> Metal uses thre primary (gray) and three secondary (blue) shades.
> In our applet we have setFg and setBg methods that automatically calculate
> the correct
> intensity levels for the three shades. That way you can change the look of
> all of Metal
> by setting just two colors:
>
> class MyMetalTheme extends MetalTheme {
>             static public ColorUIResource primary1 = new
> ColorUIResource(102, 102, 153);
>             static public ColorUIResource primary2 = new
> ColorUIResource(153, 153, 204);
>             static public ColorUIResource primary3 = new
> ColorUIResource(204, 204, 255);
>             static public ColorUIResource secondary1 = new
> ColorUIResource(102, 102, 102);
>             static public ColorUIResource secondary2 = new
> ColorUIResource(153, 153, 153);
>             static public ColorUIResource secondary3 = new
> ColorUIResource(204, 204, 204);
>
>            ... etc etc check out javax.swing.plaf.metal.MetalTheme
> };
> MyMetalTheme tema=new MyMetalTheme();
> MetalLookAndFeel plaf = (MetalLookAndFeel)UIManager.getLookAndFeel();
> plaf.setCurrentTheme(tema);
>
> ...
>
> static void setFrameBg(Color c) {
>   float hsb[]=Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
>   Applet1.tema.secondary1 =  new ColorUIResource(Color.HSBtoRGB(hsb[0],
> hsb[1], (float)(102/255.0)));
>   Applet1.tema.secondary2 =  new ColorUIResource(Color.HSBtoRGB(hsb[0],
> hsb[1], (float)(153/255.0)));
>   Applet1.tema.secondary3 =  new ColorUIResource(Color.HSBtoRGB(hsb[0],
> hsb[1], (float)(204/255.0)));
>  }
>  static void setFrameFg(Color c) {
>   float hsb[]=Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
>   Applet1.tema.primary1 =  new ColorUIResource(Color.HSBtoRGB(hsb[0],
> hsb[1], (float)(102/255.0)));
>   Applet1.tema.primary2 =  new ColorUIResource(Color.HSBtoRGB(hsb[0],
> hsb[1], (float)(153/255.0)));
>   Applet1.tema.primary3 =  new ColorUIResource(Color.HSBtoRGB(hsb[0],
> hsb[1], (float)(204/255.0)));
>  }
>
> You will probably need to do a
>
>         try{
>             UIManager.setLookAndFeel(UIManager.getLookAndFeel());
>         } catch( Exception ex){};
>         SwingUtilities.updateComponentTreeUI(applet1);
>
> whenever you change the theme.
>
>
Technical Details
Message-ID: <80cntt$k3a6@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8098vf$j5511@forums.borland.com> <80bdhh$6sl5@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,8535edc2c8bfaefe
X-Google-Attributes: gid111d45,public
From: "Ronen" <ronenm@netvision.net.il>
Subject: Re: L&F primary colors
Date: 1999/11/10
Message-ID: <80cntt$k3a6@forums.borland.com>
X-Deja-AN: 547060344
References: <8098vf$j5511@forums.borland.com> <80bdhh$6sl5@forums.borland.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing