Minggu, 10 Oktober 2010

PEMROGRAMAN VISUAL 2

import javax.swing.*;
import java.awt.*;

class Biodata extends JFrame
{
JLabel lblnama=new JLabel("Nama");
JTextField txnama=new JTextField(30);
JLabel lblttl=new JLabel("TTL");
JTextField txttl=new JTextField(40);
private JLabel lblalamat=new JLabel("ALAMAT");
private JTextArea area1=new JTextArea(3,40);
JLabel lbljeniskelamin=new JLabel("Jenis Kelamin");
JRadioButton Laki=new JRadioButton("Laki-Laki");
JRadioButton Perempuan=new JRadioButton("Perempuan");
ButtonGroup group=new ButtonGroup();
JLabel lblhobby=new JLabel("Hobby");
JCheckBox cek1=new JCheckBox("Belajar");
JCheckBox cek2=new JCheckBox("Berpetualang");
JCheckBox cek3=new JCheckBox("Bernyanyi");
JButton jbsimpan=new JButton("SIMPAN");
JButton jbexit=new JButton("EXIT");


Biodata()
{
setTitle("Biodata");
setLocation(400,100);
setSize(300,300);
getContentPane().setBackground(Color.cyan);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

void komponenVisual()
{

getContentPane().setLayout(null);
getContentPane().add(lblnama);
lblnama.setBounds(10,10,70,30);
getContentPane().add(txnama);
txnama.setBounds(75,10,150,20);
getContentPane().add(lblttl);
lblttl.setBounds(10,35,80,20);
getContentPane().add(txttl);
txttl.setBounds(75,35,150,20);
getContentPane().add(lblalamat);
lblalamat.setBounds(10,60,100,20);
getContentPane().add(area1);
area1.setBounds(75,60,150,50);
getContentPane().add(lbljeniskelamin);
lbljeniskelamin.setBounds(10,120,120,20);
getContentPane().add(Laki);
Laki.setBounds(100,120,100,20);
getContentPane().add(Perempuan);
Perempuan.setBounds(100,140,100,20);
group.add(Laki);
group.add(Perempuan);
getContentPane().add(lblhobby);
lblhobby.setBounds(10,170,50,20);
getContentPane().add(cek1);
cek1.setBounds(100,170,105,20);
getContentPane().add(cek2);
cek2.setBounds(100,190,105,20);
getContentPane().add(cek3);
cek3.setBounds(100,210,105,20);
getContentPane().add(jbsimpan);
jbsimpan.setBounds(40,250,80,20);
getContentPane().add(jbexit);
jbexit.setBounds(200,250,70,20);
setVisible(true);

}
public static void main(String args[])
{
Biodata ap=new Biodata();
ap.komponenVisual();
}
}

Tidak ada komentar:

Posting Komentar