Itchy_c
03-04-2003, 06:42 PM
I'm trying to change the color in Java with the setColor(Color.XXX); command, but I want to use the Hex code for a color so I can use more colors. Does anyone know how to do this?
| //flex table opened by JP
Click to See Complete Forum and Search --> : Programing in Java Itchy_c 03-04-2003, 06:42 PM I'm trying to change the color in Java with the setColor(Color.XXX); command, but I want to use the Hex code for a color so I can use more colors. Does anyone know how to do this? qball 03-04-2003, 06:57 PM with what Object are you trying to use the method: setColor(Color.XXX) Itchy_c 03-04-2003, 07:02 PM Graphics g, if I understand the question correctly. Itchy_c 03-04-2003, 07:02 PM Graphics g, if I understand the question correctly. I'm still learning this. DocEvi1 03-05-2003, 08:33 AM you can't just use setColour(....) without referring to an object/instance. Alternatively have you written this method? Or are you talking about javascript? Stefan Itchy_c 03-05-2003, 09:52 PM Can you give me an example? qball 03-05-2003, 09:55 PM no it's java. Since you are constrained, in default to RGB, see: http://java.sun.com/products/jdk/1.2/docs/api/java/awt/Color.html be easier to convert hex to R,G,B values unless you want to make your own Color class with hex constructor... btw, I don't think hex will give more colors as each hex pair has 255 values, each RGB index has 255 values... example: Hex={FF,CC,00} R=255 G=204 B=0 SysOpt.com
Copyright Internet.com Inc. All Rights Reserved. |