Hi There,
JDK 1.7 via NetBeans IDE 7.3.1
I have a program that asks for user input using .keyReadString();
The user can type in a color to be used to color a shape.
I know that color words can only be blue or BLUE.
How do you convert the string the user enters into a form that the drawShape( format ) can use?
I've tried:
String eColor = sg.keyReadString();
sg.drawFilledEllipse(startX, startY, (int)radius1, (int)radius2, Color.eColor, 1.0, "");
sg.drawFilledEllipse(startX, startY, (int)radius1, (int)radius2, Color.getColor(eColor), 1.0, "");
String eColor = sg.keyReadString();
double eColorC = Double.parseDouble(eColor);
sg.drawFilledEllipse(startX, startY, (int)radius1, (int)radius2, Color.eColorC, 1.0, "");
etc., always getting an error when running the program, no errors on the code itself.
Exception in thread "main" java.lang.NumberFormatException: For input string: "RED"
at sun.misc.FloatingDecimal.readJavaFormatString(Floa tingDecimal.java:1241)
at java.lang.Double.parseDouble(Double.java:540)
at shapedrawertest.ShapeDrawerTest.main(ShapeDrawerTe st.java:30)
Any ideas would be appreciated!!
Regards,