Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

awt colors

 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm looking for a color navy blue in Awt.

I have seen the colors in AWT.

java.awt.Color;

But I want navy blue.

How would I get it in AWT?


Can anyone please help me?

Thanks

 
Andrew L. Williams
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like this is what you're looking for.
Color

Just search for this constructor


It allows you to specify the color in RGB.
 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could please give some examples?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the values on this link.

. . . new Color(0x00000040) . . .
 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply.

Like below



How do I get the int value of Navy Blue or Light blue?

Is there any way to get the value?

 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure there is. Start here and work your way through.
http://java.sun.com/docs/books/tutorial/index.html
 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link, but I don't see any examples for colors in AWT.


 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anvi kon wrote:How do I get the int value of Navy Blue or Light blue?

Have you even read Campbell's post? It shows you exactly how to get the int value (he even found it for you).

Is there any way to get the value?

For the colors not defined as constants in java.awt.Color check out the link Campbell gave you, or this site.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And beware of getRGB, which does not return RGB. It returns aRGB. If you want RGB alone do a bitwise and on the aRGB with 0x00ffffff.
Note that Color has brighter and darker methods, which might help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic