/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Soal1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
*
*/
public class Soal1 extends JFrame implements ActionListener {
private static final int lebar = 700;
private static final int tinggi = 400;
private static final int x = 0;
private static final int y = 0;
Container contentPane;
private JMenu utama_1;
private JMenu utama_2;
private JLabel input;
private JTextField isiinput;
private JButton ok;
public Soal1() {
setSize(lebar, tinggi);
setTitle("UTS Satu");
setLocation(x, y);
setResizable(true);
setBackground(Color.GRAY);
contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
createUtama_1();
createUtama_2();
JMenuBar menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
menuBar.add(utama_1);
menuBar.add(utama_2);
input = new JLabel();
input.setText("Input Password");
contentPane.add(input);
isiinput = new JTextField();
isiinput.setColumns(15);
contentPane.add(isiinput);
ok = new JButton("OK");
contentPane.add(ok);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
}
private void createUtama_1() {
JMenuItem item;
utama_1 = new JMenu("Utama 1");
item = new JMenuItem("Utama 1A");
item.addActionListener(this);
utama_1.add(item);
utama_1.addSeparator();
item = new JMenuItem("Utama 1B");
item.addActionListener(this);
utama_1.add(item);
utama_1.addSeparator();
item = new JMenuItem("Utama 1C");
item.addActionListener(this);
utama_1.add(item);
}
private void createUtama_2() {
JMenuItem item;
utama_2 = new JMenu("Utama 2");
item = new JMenuItem("Utama 2A");
item.addActionListener(this);
utama_2.add(item);
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Soal1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
*
*/
public class Soal1 extends JFrame implements ActionListener {
private static final int lebar = 700;
private static final int tinggi = 400;
private static final int x = 0;
private static final int y = 0;
Container contentPane;
private JMenu utama_1;
private JMenu utama_2;
private JLabel input;
private JTextField isiinput;
private JButton ok;
public Soal1() {
setSize(lebar, tinggi);
setTitle("UTS Satu");
setLocation(x, y);
setResizable(true);
setBackground(Color.GRAY);
contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
createUtama_1();
createUtama_2();
JMenuBar menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
menuBar.add(utama_1);
menuBar.add(utama_2);
input = new JLabel();
input.setText("Input Password");
contentPane.add(input);
isiinput = new JTextField();
isiinput.setColumns(15);
contentPane.add(isiinput);
ok = new JButton("OK");
contentPane.add(ok);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
}
private void createUtama_1() {
JMenuItem item;
utama_1 = new JMenu("Utama 1");
item = new JMenuItem("Utama 1A");
item.addActionListener(this);
utama_1.add(item);
utama_1.addSeparator();
item = new JMenuItem("Utama 1B");
item.addActionListener(this);
utama_1.add(item);
utama_1.addSeparator();
item = new JMenuItem("Utama 1C");
item.addActionListener(this);
utama_1.add(item);
}
private void createUtama_2() {
JMenuItem item;
utama_2 = new JMenu("Utama 2");
item = new JMenuItem("Utama 2A");
item.addActionListener(this);
utama_2.add(item);
}
}
Tidak ada komentar:
Posting Komentar