Skip to content

Instantly share code, notes, and snippets.

@gskielian
Forked from naokirin/SwingHelloWorld.java
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gskielian/11336717 to your computer and use it in GitHub Desktop.
Save gskielian/11336717 to your computer and use it in GitHub Desktop.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SwingHelloWorld extends JFrame{
public static void main(String[] args){
SwingHelloWorld frame = new SwingHelloWorld("Hello");
frame.setSize(500,500);
frame.setVisible(true);
}
SwingHelloWorld(String title){
setTitle(title);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JLabel label1 = new JLabel("Bank Simulator");
panel.add(label1);
JLabel space = new JLabel(" ");
panel.add(space);
JLabel label2 = new JLabel("Simulation Time");
panel.add(label2);
JTextField editorField = new JTextField();
panel.add(editorField);
JLabel label3 = new JLabel("Maximum Transaction Time of Customer");
panel.add(label3);
JTextField editorField1= new JTextField();
panel.add(editorField1);
JLabel label4 = new JLabel("Enter chances (from 0 to 100) of newcustomer");
panel.add(label4);
JTextField editorField2= new JTextField();
panel.add(editorField2);
JLabel label5 = new JLabel("Enter the number of Tellers");
panel.add(label5);
JTextField editorField3= new JTextField();
panel.add(editorField3);
JLabel label6 = new JLabel("Enter the CustomerQ limit");
panel.add(label6);
JTextField editorField4= new JTextField();
panel.add(editorField4);
JLabel label7 = new JLabel("Enter 1/0 to get data from File/Random");
panel.add(label7);
JTextField editorField5= new JTextField();
panel.add(editorField5);
Button button2 = new Button("Run Simulation");
panel.add(button2);
button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//Execute when button is pressed
System.out.println("You clicked the button");
}
});
getContentPane().add(panel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment