Sunday, 15 July 2012

java - How to make a red message in Swing JOptionPane? -


I want to redude my error message, which uses swings:

  .showMessageDialog (empty, "Welcome \ nTo \ nJava \ nprogramming!", "Subject", JOptionPane.ERROR_MESSAGE);  

But this code will show a dialog box with a black message, what's the way to make it red?

  Public Zero Show Coldmessage Dialog (String Message, Color Color) {// Your Message JLabel L = label to show new jlabal (message); // Color l.setForeground (color) for your message; // Shotion page with your custom color message. Show Message Dialog Show. Job Pension. Show message dialeg (this, l); } // You can call this method as before: string msg = "hello world!"; // Display this message with the red color show ColoredMessageDialog (msg, Color.red); // or you can also send messages with variables values ​​int count = 10; String msg2 = "The value of the count is:" + count; // Display this message but this time with the green show, the collimated diagonal (msg2, Color.green);  

No comments:

Post a Comment