Studyon Minte9.com
Java SE




Message Dialog




package testexample; import java.awt.*; import javax.swing.*; public class Test extends JFrame { public static void main(String[] args) { Test frame = new Test(); frame.setBounds(200, 200, 400, 300); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.setVisible(true); JOptionPane.showMessageDialog(null, "Bad format!"); // Message in the middle of the screen JOptionPane.showMessageDialog(frame, "Bad format!"); // --- Look Here --- // // Message in the middle of the frame } }