Script Java Kalkulatorku
Diposting oleh
M. Rizal
Rabu, 07 Desember 2011
Hai kawan, ini Script Java untuk Design Form Aplikasi Calculator Ku, adapun untuk sript Command event nya belum jadi menyusul ya... hehehe
Silakan Kalo kalo mau sharing , tapi jangan lupa di Compile dulu, baru Running.......
Selamat mencoba Mas Bro & Mbak Bro...............
_________________________________________________________
import java.awt.*;
import java.awt.event.*;
public class Calculator{
//default constructor
public Calculator(){
Frame frm1 = new Frame("Rizal Calculator V.1.0");
frm1.setSize(530,450);
frm1.setLayout(null);
frm1.setBackground(Color.orange);
Label lblNama = new Label ("Rama Calculator");
frm1.add(lblNama);
lblNama.setFont(new Font("Monospaced",Font.BOLD,20));
lblNama.setBounds(300,50,200,25);
Label garisBawah = new Label (">>>>>>>>>>>>>>>>>>");
frm1.add(garisBawah);
garisBawah.setFont(new Font("Monospaced",Font.BOLD,16));
garisBawah.setBounds(300,70,200,25);
// NILAI
Label lblNilai1 = new Label ("Nilai 1");
TextField tfNilai1 = new TextField ("");
frm1.add(lblNilai1);
frm1.add(tfNilai1);
lblNilai1.setBounds(50,75,100,25);
tfNilai1.setBounds(150,75,100,25);
Label lblNilai2 = new Label ("Nilai 2");
TextField tfNilai2 = new TextField ("");
frm1.add(lblNilai2);
frm1.add(tfNilai2);
lblNilai2.setBounds(50,115,100,25);
tfNilai2.setBounds(150,115,100,25);
// OPERASI
Label lblOperasi = new Label ("Operasi :");
frm1.add(lblOperasi);
lblOperasi.setBounds(50,150,150,25);
CheckboxGroup ops = new CheckboxGroup();
Checkbox operasi1 = new Checkbox("Pangkat", ops, true);
Checkbox operasi2 = new Checkbox("Akar Kuadrat", ops, true);
Checkbox operasi3 = new Checkbox("Pembagian", ops, true);
frm1.add(operasi1);
frm1.add(operasi2);
frm1.add(operasi3);
operasi1.setBounds(50,180,150,25);
operasi2.setBounds(50,210,150,25);
operasi3.setBounds(50,240,150,25);
// WARNA BACKGROUND
Label lblWarna = new Label ("Warna Background");
frm1.add(lblWarna);
lblWarna.setBounds(300,150,150,25);
Checkbox cekBox = new Checkbox ();
frm1.add(cekBox);
cekBox.setBounds(455,150,25,25);
Choice chooser = new Choice();
frm1.add(chooser);
chooser.setBounds(300,180,170,25);
chooser.add("Merah");
chooser.add("Biru");
chooser.add("Kuning");
chooser.add("Hijau");
// WARNA HURUF
Label lblHuruf = new Label ("Warna Huruf");
frm1.add(lblHuruf);
lblHuruf.setBounds(300,240,150,25);
Checkbox cekBox2 = new Checkbox ();
frm1.add(cekBox2);
cekBox2.setBounds(455,240,25,25);
Choice chooser2 = new Choice();
frm1.add(chooser2);
chooser2.setBounds(300,270,170,25);
chooser2.add("Merah");
chooser2.add("Biru");
chooser2.add("Kuning");
chooser2.add("Hijau");
// HASIL OPERASI
Label lblHasil = new Label ("Hasil Operasi");
frm1.add(lblHasil);
lblHasil.setBounds(50,300,150,25);
TextField tfHasil = new TextField ("");
frm1.add(tfHasil);
tfHasil.setBounds(50,330,200,25);
// BUTTON
Button btnHasil = new Button ("Hasil");
frm1.add(btnHasil);
btnHasil.setBounds(150,380,100,25);
btnHasil.setBackground(Color.red);
Button btnBatal = new Button ("Batal");
frm1.add(btnBatal);
btnBatal.setBounds(300,380,100,25);
btnBatal.setBackground(Color.red);
frm1.setVisible(true);
frm1.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
//main method
public static void main(String args[]){
Calculator calc = new Calculator();
}
}
_________________________________________________________
Langganan:
Posting Komentar (Atom)
1 komentar:
wah mantep kie katoke bang, ijin copas yow, penasaran pingin nyacak..ehheheheh,,,:)
Posting Komentar