Member Avatar for jaredleo999

I have:

JButton b1 = new JButton();
 b1.setForeground(Color.BLUE);
the button labelled b1 turns blue and all is working, 
However is it possible to use some function like:
String ButtonColor = "BLUE";
b1.setForeground(Color.(ButtonColor.getText()));

I ask this because i want to get the colour from a different class..

Any help appreciated thanks!

You cannot pass string to Color class as parameter as the class hasn't got such constructor

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.