File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes awt colors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "awt colors" Watch "awt colors" New topic
Author

awt colors

anvi kon
Ranch Hand

Joined: Jan 08, 2010
Posts: 133
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

Joined: Mar 15, 2010
Posts: 4
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

Joined: Jan 08, 2010
Posts: 133
Could please give some examples?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39799
    
  28
Try the values on this link.

. . . new Color(0x00000040) . . .
anvi kon
Ranch Hand

Joined: Jan 08, 2010
Posts: 133
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

Joined: May 03, 2008
Posts: 4658
    
    5

Sure there is. Start here and work your way through.
http://java.sun.com/docs/books/tutorial/index.html


luck, db
There are no new questions, but there may be new answers.
anvi kon
Ranch Hand

Joined: Jan 08, 2010
Posts: 133
Thanks for the link, but I don't see any examples for colors in AWT.


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39799
    
  28
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.
 
 
subject: awt colors