import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
publicclass DisplayingMultilineMessages {
publicstaticvoid main(String[] a) {
String msg = "<html>this is a really long message<br>this is a really long message this is a really long message this is a really long message this is a really long message this is a really long message this is a really long message";
JOptionPane optionPane = new NarrowOptionPane();
optionPane.setMessage(msg);
optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
JDialog dialog = optionPane.createDialog(null, "Width 100");
dialog.setVisible(true);
}
}
class NarrowOptionPane extends JOptionPane {
NarrowOptionPane() {
}
publicint getMaxCharactersPerLineCount() {
return 100;
}
}