Return to Snippet

Revision: 35846
at November 14, 2010 13:25 by mouseroot


Initial Code
import javax.swing.*;
import java.awt.*;

String test = "<html><font color=green>Test<br></font></html>";
ShowMsg(test,"Testing HTML");


public static void ShowMsg(String in,String title)
    {
        JOptionPane.showMessageDialog( null,
        new JLabel(in),title,JOptionPane.INFORMATION_MESSAGE );
    }

Initial URL

                                

Initial Description
I didnt know you could do this but you can put JComponets from awt or swing inside 
JOptionPane.showMessageDialog ...probly other variations also who knows

this is excellent for html formatting inside a messagebox

Initial Title
JComponents inside JOptionPane.showMessageDialog();

Initial Tags

                                

Initial Language
Java