import java.awt.event.*;
import javax.swing.*;
public class latihan extends JFrame implements ActionListener
{
//private JFrame frame;
private JLabel lbNIM, lbNama, lbTLahir, lbTglLahir, lbJKel, lbAgama, lbAlamat, lbNoHP, lbEmail, lbHobi;
private JTextField tfNIM, tfNama, tfTLahir, tfAlamat, tfNoHP, tfEmail, tfTahun;
private JComboBox cbTanggal, cbBulan, cbAgama;
private JRadioButton rbLakilaki, rbPerempuan;
private JCheckBox chMembaca, chBerenang, chMemancing, chGame, chMemasak;
private JButton btBatal, btSimpan;
public latihan()
{
setTitle("Form Biodata");
setSize(600,600);
setLayout(null);
setDefaultCloseOperation(JFram e.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
lbNIM = new JLabel("NIM");
lbNIM.setBounds(20,20,100,25);
add(lbNIM);
lbNama = new JLabel("Nama");
lbNama.setBounds(20,60,100,25) ;
add(lbNama);
lbTLahir = new JLabel("Tempat Lahir");
lbTLahir.setBounds(20,100,100, 25);
add(lbTLahir);
lbTglLahir = new JLabel("Tanggal Lahir");
lbTglLahir.setBounds(20,140,10 0,25);
add(lbTglLahir);
lbJKel = new JLabel("Jenis Kelamin");
lbJKel.setBounds(20,180,100,25 );
add(lbJKel);
lbAgama = new JLabel("Agama");
lbAgama.setBounds(20,220,100,2 5);
add(lbAgama);
lbAlamat = new JLabel("Alamat");
lbAlamat.setBounds(20,260,100, 25);
add(lbAlamat);
lbNoHP = new JLabel("No HP");
lbNoHP.setBounds(20,300,100,25 );
add(lbNoHP);
lbEmail = new JLabel("Email");
lbEmail.setBounds(20,340,100,2 5);
add(lbEmail);
lbHobi = new JLabel("Hobi");
lbHobi.setBounds(20,380,100,25 );
add(lbHobi);
tfNIM = new JTextField(20);
tfNIM.setBounds(120,20,100,25) ;
add(tfNIM);
tfNama = new JTextField(20);
tfNama.setBounds(120,60,200,25 );
add(tfNama);
tfTLahir = new JTextField(20);
tfTLahir.setBounds(120,100,150 ,25);
add(tfTLahir);
tfTahun = new JTextField("Tahun",20);
tfTahun.setBounds(360,140,100, 25);
add(tfTahun);
tfAlamat = new JTextField(20);
tfAlamat.setBounds(120,260,275 ,25);
add(tfAlamat);
tfNoHP = new JTextField(20);
tfNoHP.setBounds(120,300,150,2 5);
add(tfNoHP);
tfEmail = new JTextField(20);
tfEmail.setBounds(120,340,150, 25);
add(tfEmail);
cbTanggal = new JComboBox();
cbTanggal.setBounds(120,140,12 5,25);
add(cbTanggal);
cbTanggal.addItem("Tanggal");
for (int n =1 ; n<=31; n++)
{
cbTanggal.addItem(new String().valueOf(n));
}
cbBulan = new JComboBox();
cbBulan.setBounds(250,140,100, 25);
add(cbBulan);
String[]bulan = {"Bulan","Januari","Februari", "Maret","April","Mei","Juni"," Juli","Agustus","September","O ktober","November","Desember"} ;
for(int m=0;m<bulan.length;m++)
{
cbBulan.addItem(bulan[m]);
}
cbAgama = new JComboBox();
cbAgama.setBounds(120,220,100, 25);
add(cbAgama);
String[]agama = {"Islam","Kristen","Katholik", "Hindu","Budha","Konghucu"};
for( int j = 0; j<agama.length; j++)
{
cbAgama.addItem(agama[j]);
}
rbLakilaki = new JRadioButton("Laki-laki");
rbLakilaki.setBounds(120,180,1 50,25);
rbLakilaki.setSize(rbLakilaki. getPreferredSize());
add(rbLakilaki);
rbPerempuan = new JRadioButton("Perempuan");
rbPerempuan.setBounds(200,180, 150,25);
rbPerempuan.setSize(rbPerempua n.getPreferredSize());
add(rbPerempuan);
ButtonGroup group = new ButtonGroup();
group.add(rbLakilaki);
group.add(rbPerempuan);
chMembaca = new JCheckBox("Membaca",false);
chMembaca.setBounds(120,380,15 0,25);
add(chMembaca);
chBerenang = new JCheckBox("Berenang",false);
chBerenang.setBounds(120,400,1 50,25);
add(chBerenang);
chMemancing = new JCheckBox("Memancing",false);
chMemancing.setBounds(120,420, 150,25);
add(chMemancing);
chGame = new JCheckBox("Game",false);
chGame.setBounds(120,440,150,2 5);
add(chGame);
chMemasak = new JCheckBox("Memasak",false);
chMemasak.setBounds(120,460,15 0,25);
add(chMemasak);
btBatal = new JButton("Batal");
btBatal.setBounds(20,520,100,2 5);
add(btBatal);
btBatal.addActionListener(this );
btSimpan = new JButton("Simpan");
btSimpan.setBounds(420,520,100 ,25);
add(btSimpan);
btSimpan.addActionListener(thi s);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==btBatal)
{
tfNIM.setText("");
tfNama.setText("");
tfTLahir.setText("");
tfAlamat.setText("");
tfNoHP.setText("");
tfEmail.setText("");
tfTahun.setText("Tahun");
cbTanggal.setSelectedItem("Tan ggal");
cbBulan.setSelectedIndex(0);
cbAgama.setSelectedIndex(0);
rbLakilaki.setSelected(false);
rbPerempuan.setSelected(true);
chMembaca.setSelected(false);
chBerenang.setSelected(false);
chMemancing.setSelected(false) ;
chGame.setSelected(false);
chMemasak.setSelected(false);
}
}
public static void main(String[]args)
{
latihan fb = new latihan();
fb.setVisible(true);
}
}
import javax.swing.*;
public class latihan extends JFrame implements ActionListener
{
//private JFrame frame;
private JLabel lbNIM, lbNama, lbTLahir, lbTglLahir, lbJKel, lbAgama, lbAlamat, lbNoHP, lbEmail, lbHobi;
private JTextField tfNIM, tfNama, tfTLahir, tfAlamat, tfNoHP, tfEmail, tfTahun;
private JComboBox cbTanggal, cbBulan, cbAgama;
private JRadioButton rbLakilaki, rbPerempuan;
private JCheckBox chMembaca, chBerenang, chMemancing, chGame, chMemasak;
private JButton btBatal, btSimpan;
public latihan()
{
setTitle("Form Biodata");
setSize(600,600);
setLayout(null);
setDefaultCloseOperation(JFram
setLocationRelativeTo(null);
lbNIM = new JLabel("NIM");
lbNIM.setBounds(20,20,100,25);
add(lbNIM);
lbNama = new JLabel("Nama");
lbNama.setBounds(20,60,100,25)
add(lbNama);
lbTLahir = new JLabel("Tempat Lahir");
lbTLahir.setBounds(20,100,100,
add(lbTLahir);
lbTglLahir = new JLabel("Tanggal Lahir");
lbTglLahir.setBounds(20,140,10
add(lbTglLahir);
lbJKel = new JLabel("Jenis Kelamin");
lbJKel.setBounds(20,180,100,25
add(lbJKel);
lbAgama = new JLabel("Agama");
lbAgama.setBounds(20,220,100,2
add(lbAgama);
lbAlamat = new JLabel("Alamat");
lbAlamat.setBounds(20,260,100,
add(lbAlamat);
lbNoHP = new JLabel("No HP");
lbNoHP.setBounds(20,300,100,25
add(lbNoHP);
lbEmail = new JLabel("Email");
lbEmail.setBounds(20,340,100,2
add(lbEmail);
lbHobi = new JLabel("Hobi");
lbHobi.setBounds(20,380,100,25
add(lbHobi);
tfNIM = new JTextField(20);
tfNIM.setBounds(120,20,100,25)
add(tfNIM);
tfNama = new JTextField(20);
tfNama.setBounds(120,60,200,25
add(tfNama);
tfTLahir = new JTextField(20);
tfTLahir.setBounds(120,100,150
add(tfTLahir);
tfTahun = new JTextField("Tahun",20);
tfTahun.setBounds(360,140,100,
add(tfTahun);
tfAlamat = new JTextField(20);
tfAlamat.setBounds(120,260,275
add(tfAlamat);
tfNoHP = new JTextField(20);
tfNoHP.setBounds(120,300,150,2
add(tfNoHP);
tfEmail = new JTextField(20);
tfEmail.setBounds(120,340,150,
add(tfEmail);
cbTanggal = new JComboBox();
cbTanggal.setBounds(120,140,12
add(cbTanggal);
cbTanggal.addItem("Tanggal");
for (int n =1 ; n<=31; n++)
{
cbTanggal.addItem(new String().valueOf(n));
}
cbBulan = new JComboBox();
cbBulan.setBounds(250,140,100,
add(cbBulan);
String[]bulan = {"Bulan","Januari","Februari",
for(int m=0;m<bulan.length;m++)
{
cbBulan.addItem(bulan[m]);
}
cbAgama = new JComboBox();
cbAgama.setBounds(120,220,100,
add(cbAgama);
String[]agama = {"Islam","Kristen","Katholik",
for( int j = 0; j<agama.length; j++)
{
cbAgama.addItem(agama[j]);
}
rbLakilaki = new JRadioButton("Laki-laki");
rbLakilaki.setBounds(120,180,1
rbLakilaki.setSize(rbLakilaki.
add(rbLakilaki);
rbPerempuan = new JRadioButton("Perempuan");
rbPerempuan.setBounds(200,180,
rbPerempuan.setSize(rbPerempua
add(rbPerempuan);
ButtonGroup group = new ButtonGroup();
group.add(rbLakilaki);
group.add(rbPerempuan);
chMembaca = new JCheckBox("Membaca",false);
chMembaca.setBounds(120,380,15
add(chMembaca);
chBerenang = new JCheckBox("Berenang",false);
chBerenang.setBounds(120,400,1
add(chBerenang);
chMemancing = new JCheckBox("Memancing",false);
chMemancing.setBounds(120,420,
add(chMemancing);
chGame = new JCheckBox("Game",false);
chGame.setBounds(120,440,150,2
add(chGame);
chMemasak = new JCheckBox("Memasak",false);
chMemasak.setBounds(120,460,15
add(chMemasak);
btBatal = new JButton("Batal");
btBatal.setBounds(20,520,100,2
add(btBatal);
btBatal.addActionListener(this
btSimpan = new JButton("Simpan");
btSimpan.setBounds(420,520,100
add(btSimpan);
btSimpan.addActionListener(thi
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==btBatal)
{
tfNIM.setText("");
tfNama.setText("");
tfTLahir.setText("");
tfAlamat.setText("");
tfNoHP.setText("");
tfEmail.setText("");
tfTahun.setText("Tahun");
cbTanggal.setSelectedItem("Tan
cbBulan.setSelectedIndex(0);
cbAgama.setSelectedIndex(0);
rbLakilaki.setSelected(false);
rbPerempuan.setSelected(true);
chMembaca.setSelected(false);
chBerenang.setSelected(false);
chMemancing.setSelected(false)
chGame.setSelected(false);
chMemasak.setSelected(false);
}
}
public static void main(String[]args)
{
latihan fb = new latihan();
fb.setVisible(true);
}
}
If you're trying to lose weight then you certainly have to start following this totally brand new custom keto plan.
BalasHapusTo create this keto diet, certified nutritionists, fitness trainers, and professional chefs have united to develop keto meal plans that are productive, suitable, cost-efficient, and fun.
Since their launch in early 2019, hundreds of people have already remodeled their body and health with the benefits a certified keto plan can offer.
Speaking of benefits: in this link, you'll discover 8 scientifically-tested ones offered by the keto plan.