Results 1 to 2 of 2
Thread: Change color with hex code?
- 09-03-2012, 07:39 PM #1Member
- Join Date
- Sep 2012
- Rep Power
Change color with hex code?
I am trying to write a code to change the color with a hex code. Actually I want to add my own colors instead of "black" "red" and so on. So if I write skyblue it should use "#3398F0".
I am working on the example project of BlueJ. If you use this program you should have it too.
Take a look at the picture. How can I add some different colors?
- 09-03-2012, 09:31 PM #2
Re: Change color with hex code?
Take a look at the constructors of java.awt.Color that take int parameters. Also Integer methods that take a String and an int radix.
Alternatively, you can hard-code a Map<String, Color> to do the lookup.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- By Jeffrey4u in forum Sun Java Wireless ToolkitReplies: 0Last Post: 10-22-2011, 08:32 AM
- By armedrabbit in forum New To JavaReplies: 9Last Post: 04-20-2011, 08:51 PM
- By mrbeast87 in forum AWT / SwingReplies: 5Last Post: 11-16-2010, 09:22 PM
- By sky in forum AWT / SwingReplies: 5Last Post: 11-24-2009, 03:47 PM
- By javanoobita in forum New To JavaReplies: 5Last Post: 02-22-2009, 04:30 AM