List of usage examples for javax.swing JOptionPane showMessageDialog
public static void showMessageDialog(Component parentComponent, Object message) throws HeadlessException
From source file:Main.java
public static void main(final String args[]) { String label = "<html>" + "This is a" + "<br>" + "swing button" + "</html>"; JButton button = new JButton(label); JOptionPane.showMessageDialog(null, button); }
From source file:Main.java
public static void main(String[] args) { JComboBox<Country> countryBox = new JComboBox<Country>(Country.values()); JOptionPane.showMessageDialog(null, new JScrollPane(countryBox)); }
From source file:Main.java
public static void main(String[] args) { UnderlinedLabel label = new UnderlinedLabel("java2s.com"); JOptionPane.showMessageDialog(null, label); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("Click me"); button.addActionListener(e -> JOptionPane.showMessageDialog(frame, "Hello World!")); frame.getContentPane().add(button);//from w w w. ja va 2 s. c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(final String args[]) { Icon icon = new ImageIcon("dog.jpg"); JButton button = new JButton(icon); JOptionPane.showMessageDialog(null, button); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("java2s.com", JLabel.LEFT); label.setPreferredSize(new Dimension(150, 100)); JOptionPane.showMessageDialog(null, label); }
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("Full Name :", JLabel.LEFT); label.setFont(new Font("Georgia", Font.PLAIN, 14)); JOptionPane.showMessageDialog(null, label); }
From source file:MainClass.java
public static void main(String[] args) { Timer t = new Timer(1000, new Ticker()); t.start();//from www .j a va 2 s .c o m JOptionPane.showMessageDialog(null, "Click OK to exit program"); System.exit(0); }
From source file:Main.java
public static void main(final String args[]) { Icon icon = new ImageIcon("dog.jpg"); JButton button = new JButton("Dog", icon); JOptionPane.showMessageDialog(null, button); }
From source file:Main.java
public static void main(String[] args) { Icon icon = new ImageIcon("yourImage.png"); JLabel label = new JLabel("Full Name :", icon, JLabel.LEFT); JOptionPane.showMessageDialog(null, label); }