• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hexadecimal Colors from property file

 
Anoop Krishnan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am building an applet which could be configurable for different clients.
So I use a property file to specify the configuration info.
The biggest problem is to specify the colors.
I have to pass the color info to a special library created using jdk1.1.8
which can only use integer representation of the Color info.
for eg 0XFFFFFFFF.ie ALPHA,RED,GREEN,BLUE
I want to make it configurable so I write a property
color=FFFFFFFF in my property file
in My java code I use
int color1=Integer.parseInt(props.getProperty("color"),16);
this throws a number format exception because this number is out of range for Integer type.
but if I use int color1=0XFFFFFFFF there is no problem.

I didn't understand what is the difference between the 2 numbers.
int color1=0XFFFFFFFF
String color=color="FFFFFFFF";
int color1=Integer.parseInt(props.getProperty("color"),16);

How can I store this info in a property file and get the property with out any loss of precision.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic