import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JSlider;
public class ComplexMessageDemo {
public static void main(String[] a) {
Object complexMsg[] = { "Above Message", new ImageIcon("yourFile.gif"), new JButton("Hello"),
new JSlider(), new ImageIcon("yourFile.gif"), "Below Message" };
JOptionPane optionPane = new JOptionPane();
optionPane.setMessage(complexMsg);
optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
JDialog dialog = optionPane.createDialog(null, "Width 100");
dialog.setVisible(true);
}
}
|