Theinput in a JTextField must be used in the variable Color color.
input = YELLOW must change variable color in Color.YELLOW.
My attempt does not work:
cor.vandijk.779
0
Newbie Poster
Recommended Answers
Jump to PostIf you don't show us your code we cannot tell you what's wrong with it.
Jump to PostYou will need to convert the String obtained from the textfield to a Color object.
One way would be to use a chain of if/else if statements to compare the String and set the Color, or switch with 1.7,
another would be to use a Map<String, Color> that has been …
All 7 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
cor.vandijk.779
0
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
cor.vandijk.779
0
Newbie Poster
cor.vandijk.779
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.