Yang lagi belajar java kayak gue, membuat
button rasanya sangat sulit. Tapi semua itu akan terasa mudah kalau kita mau. Contoh
program java button ada di bawah tinggal dicopas aja!!!!!
import javax.swing.*;
public class contohJButton extends JFrame{
private
JButton button1;
private
JComboBox combo;
private
JCheckBox cek;
private
JRadioButton radio;
public
contohJButton() {
super("restu 10.5.00051");
//
membuat tombol
this.button1 = new JButton("Tombol");
this.button1.setBounds(200,200,100,30);
this.add(this.button1);
// membuat combobox
this.combo
= new JComboBox();
this.combo.setBounds(0,200,100,30);
this.add(this.combo);
combo.addItem("setyawan");
combo.addItem("restu");
// membuat cekbok
this.cek =
new JCheckBox("chek");
this.cek.setBounds(100,100,100,30);
this.add(this.cek);
//
membuat tampilan
this.setLayout(null);
this.setSize(400,400);
this.setVisible(true);
}
public static
void main (String[] args){
new
contohJButton();
}
}
0 komentar :
Posting Komentar