1. importjavax.swing.*;
importjava.awt.*;
importjava.awt.event.*;
public class uas extends JFrame implements ActionListener
{
JLabelnama,kota,kode,harga,pesan,total;
JTextFieldtxtnama,txtkode,txtharga,txtpesan,txttotal;
JComboBoxcbokota;
JPanel panel= new JPanel();
JButtonhitung,keluar;
publicuas()
{
setTitle("UaS");
setSize(350,400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
nama = new JLabel("NamaPemesan");
txtnama = new JTextField();
kota = new JLabel("Kota Tujuan");
cbokota = new JComboBox(new String[]{"","Jakarta","Bandung","Semarang"});
kode = new JLabel("KodeKendaraan");
txtkode = new JTextField();
harga = new JLabel("Harga");
txtharga = new JTextField();
pesan = new JLabel("JmlPesan");
txtpesan = new JTextField();
total = new JLabel("Total");
2. txttotal = new JTextField();
hitung = new JButton("Hitung");
hitung.addActionListener(this);
keluar = new JButton("Keluar");
keluar.addActionListener(this);
nama.setBounds(30,30,100,25);
txtnama.setBounds(130,30,100,25);
kota.setBounds(30,60,100,25);
cbokota.setBounds(130,60,100,25);
kode.setBounds(30,90,100,25);
txtkode.setBounds(130,90,100,25);
harga.setBounds(30,120,100,25);
txtharga.setBounds(130,120,100,25);
pesan.setBounds(30,150,100,25);
txtpesan.setBounds(130,150,100,25);
total.setBounds(30,180,100,25);
txttotal.setBounds(130,180,100,25);
hitung.setBounds(75,210,90,25);
keluar.setBounds(190,210,90,25);
panel.add(nama);