import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Main{
public static void main(String[] args){
new Main();
}
public Main(){
frame = new JFrame("Event Application");
bDialog = new JButton("Show Dialog");
bDialog.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
JOptionPane.showMessageDialog( frame,
"Holla World");
}
});
frame.add(bDialog);
frame.setLayout(new FlowLayout(FlowLayout.CENTER));
frame.setSize(400, 300);
frame.setLocation(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
private JFrame frame;
private JButton bDialog;
}
No comments:
Post a Comment