aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Is it possible to get a light-blue color? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Is it possible to get a light-blue color?" Watch "Is it possible to get a light-blue color?" New topic
Author

Is it possible to get a light-blue color?

ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Ever-helping ranchers,
In my application I want to use light-blue color.
Color.blue always gives a darker version of the color.
How to get & use light-blue color?
Throw some light on this?
Regards
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Did you take a look at the Color API? I am sure there must be methods to make a color darker (hint) or brighter(hint).

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Thanks manish for your observations, but still the challenge is not succeeded.


Some error trace :


I'm not worried about the others.
If somebody could help me in getting that lightblue color I would be happy.
Regards
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

The exceptions are generated because you are trying access the System resources from an unsigned applet.
Why are you trying to print it out? I mean you can see it on the screen right?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Ok.
Lets get it over and done with.
Use something like
or
The API will give you information on what the 4 parameters mean.
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338


This is working fine.
While the other when I tried it with


was not working fine.

But anyhow thanks for the information maneesh.
Meanwhile how did you know of the parameters
new Color(0,0,182,155)

Regards
Omar Nasir
Greenhorn

Joined: Jul 11, 2005
Posts: 5
Dear Ramya,



found in the site :

http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Color.html


i hope this helps.

Regards,

Omar


javaNoob me = new javaNoob();<br />String i = "i";<br />i += "love java!";
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
And to get the rgb values of a Color that you want, use a Color Picker.
Or try it out on MS Paint or even Word.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

ramya narayanan wrote:
Meanwhile how did you know of the parameters
new Color(0,0,182,155)


Because unlike you, I read the whole API carefully (Just kidding)
It is just one of the things you tend to pick up, playing around with stuff. Ever wanted to make over transparent UI components? Then the 'alpha' is your friend.

One interesting point with the brighter.
It is perfectly legal to do this until you are satisfied.


ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Helping ranchers,
First of all my humble thanks to all maneesh, sridhar & others who have shared their expertise & made my job easier.

And to get the rgb values of a Color that you want, use a Color Picker.
Or try it out on MS Paint or even Word.


1) How to get that rgb values using that?

2) Also when I went through the API there are two constructors with & without alpha value.
What is this alpha value & what is its significance?

Regards
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Ever-helping ranchers,

But this is not changing into lightblue color which I want.
Regards
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Maneesh has told you what "alpha" means, and there is more about it in the Color class.

This looks like a GUI-related thread, so it would be more appropriate for the Swing forum. Moving.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11422
    
  16

From the API page for the Color class:

The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary color spaces identified by a ColorSpace. Every color has an implicit alpha value of 1.0 or an explicit one provided in the constructor. The alpha value defines the transparency of a color and can be represented by a float value in the range 0.0 - 1.0 or 0 - 255. An alpha value of 1.0 or 255 means that the color is completely opaque and an alpha value of 0 or 0.0 means that the color is completely transparent. When constructing a Color with an explicit alpha or getting the color/alpha components of a Color, the color components are never premultiplied by the alpha component.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Take a look at this color picker. Once you have the color code you want, change the hex code (#XXXXXX) to RGB values. The first two is Red, The next two Green and last two Blue.

Or better there must be some color picker which gives you directly RGB values.
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Word - > Font Color -> more colors -> Custom-> select the color and get the RGB values.

Hope this helps.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

//tried a bit, might require some more work, blue shade of the label changes based on alpha value


Swastik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to get a light-blue color?