Create a two-line message dialog with JOptionPane in Java
Description
The following code shows how to create a two-line message dialog with JOptionPane.
Example
/*w w w .j a v a 2 s .com*/
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
String message = "Line1\nLine2";
JOptionPane.showMessageDialog(null, message);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »