import javax.swing.JFrame; import javax.swing.JOptionPane; public class Main { public static void main(String[] argv) throws Exception { // Modal dialog with OK button String message = "Line1\nLine2"; JFrame frame = new JFrame(); JOptionPane.showMessageDialog(frame, message); } }