Need help with changing color of JOptionPane
Hello,
I need to change the color of output box to white. I guess the best would be to use UIManager.put("OptionPane.messageForeground", Color.white);? how do i use this? Sorry, I am very new to java
Code java:
import java.awt.Color;
import javax.swing.*;
public class square{
public void perimeter(){
double sq;
String shape2 = JOptionPane.showInputDialog("Enter shape you want to calculate the circumference for - Enter 1-square, 2-rectangle, 3-circle, 4-triangle, and 5-Exit. ");
int shape = Integer.parseInt(shape2);
if (shape ==1){
String square2 = JOptionPane.showInputDialog("Enter numeric value in centimeters ");
double square = Double.parseDouble(square2);
sq= 4 * square;
JOptionPane.showMessageDialog(null,
"You selected Square \n Length of each side= " + square + " cm \n Area=" + sq +"cm");
}
if (shape ==5){
System.exit(0);
}}}
Re: Need help with changing color of JOptionPane
Also, i need to create a color() method so other classes can inherit it. many thx!!!