Results 1 to 2 of 2
Thread: Change color with hex code?
- 09-03-2012, 08: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, 10: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.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
- By Jeffrey4u in forum Sun Java Wireless ToolkitReplies: 0Last Post: 10-22-2011, 09:32 AM
- By armedrabbit in forum New To JavaReplies: 9Last Post: 04-20-2011, 09:51 PM
- By mrbeast87 in forum AWT / SwingReplies: 5Last Post: 11-16-2010, 10:22 PM
- By sky in forum AWT / SwingReplies: 5Last Post: 11-24-2009, 04:47 PM
- By javanoobita in forum New To JavaReplies: 5Last Post: 02-22-2009, 05:30 AM