Top.Mail.Ru
September 9th, 2004 - Java developers — LiveJournal
? ?

Java developers

September 9th, 2004

05:10 pm - guilty - dunno if this makes any sense, but..

We're currently covering GUIs in class.. Current excersise is to create an app with three buttons, labelled red, green and blue, which will change the background colour of the app when pressed. Usual way to do it would be a handler for each button that changes the background to the corresponding colour.

Being a contrary bastard, I wanted to do it with a single handler for all three buttons; basically, I'm grabbing the string (ie, BLUE) with the JButton.getText() method, now i want to create a Colour object using the constants in java.awt.color (ie, i have the string "BLUE", and want to create a new color(Color.BLUE))

Is there a way to do this?

Is it a good idea?

Am I wasting my time?

Am I EVER going to need to do something like that in Real Life?

09:47 pm - guilty - Found a solution..

I found a solution to my earlier question, for any of you interested.

Read more...Collapse )
Powered by LiveJournal.com