• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hexadecimal Colors from property file

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic