public class SimpleATM { public static void addComponent(Container cp) { cp.setLayout(new GridLayout(2,1)); JLabel name = new JLabel("Balance :"); JLabel amount = new JLabel("Amount:"); JTextField nameInput = new JTextField("10000",15); JTextField amountInput = new JTextField(15); nameInput.setEditable(false); cp.add(name); cp.add(nameInput); cp.add(amount); cp.add(amountInput); }
public static void main(String[] args) { JFrame frame = new JFrame("Simple ATM");//Title Bar JPanel content = new JPanel(); addComponent(content); JPanel buttonPane = new JPanel(); buttonPane.add(new JButton("Withdraw"));//Withdraw Button buttonPane.add(new JButton("Deposit"));//Deposit Button buttonPane.add(new JButton("Exit"));//Exit Button frame.setLayout(new BorderLayout()); frame.add(content, BorderLayout.NORTH); frame.add(buttonPane, BorderLayout.AFTER_LAST_LINE);
public class InformationForm { public static void addComponent(Container cp) { //----------------------Field Name & Lastname-----------------------// cp.setLayout(new GridLayout(5,2)); //Set Grid : 5.2 JLabel name = new JLabel("Firstname : "); JLabel amount = new JLabel("Lastname : "); JTextField nameInput = new JTextField(15); JTextField amountInput = new JTextField(15); //----------------------Field Name & Lastname-----------------------//
//----------------------RadioButton [Gender]-----------------------// JLabel label = new JLabel("Gender : "); JPanel gender = new JPanel(); JRadioButton a = new JRadioButton("Male"); JRadioButton b = new JRadioButton("Female", true); //----------------------RadioButton [Gender]-----------------------//
//----------------------CheckBox [Location]-----------------------// JLabel lolabel = new JLabel("Location : "); JPanel location = new JPanel(); JCheckBox c = new JCheckBox("Khonkaen", true); JCheckBox d = new JCheckBox("Bangkok"); JCheckBox e = new JCheckBox("Chiang rai", true); JCheckBox f = new JCheckBox("Chiang mai", true); //----------------------CheckBox [Location]-----------------------//
//--------------Favorite Programming Languages--------------------// JLabel plabel = new JLabel("Favorite Programming Languages : "); JComboBox LangChoice = new JComboBox(); LangChoice.addItem("Java"); LangChoice.addItem("php"); LangChoice.addItem("C++"); LangChoice.addItem("C#"); LangChoice.setEditable(true); //--------------Favorite Programming Languages--------------------//
ทามรายยยยอยุ
ช่วงนี้มะค่อยได้ขับรถสวนทางกันเรยยนะ