import javax.swing.JLabel; import javax.swing.JOptionPane; import java.awt.Color; public class dialog { public static void main(String[] a) { // define a label containing the text "hello" in red JLabel mylabel = new JLabel("hello"); mylabel.setForeground(new Color(255, 0, 0)); // display a message dialog showing our label JOptionPane.showMessageDialog(null, mylabel); } }