lukmanunindra

Home » Pemograman Visual » Pertemuan 3

Pertemuan 3

Penggunaan Check Box

 

package pertemuan3;

import javax.swing.*;
class checkBox {
public static void main(String[]args){
JCheckBox c1 = new JCheckBox(“Pilihan 1”);
JFrame frame = new JFrame();

frame.setSize(200,200);
c1.setBounds(50,50,150,25);
frame.add(c1);
frame.setLayout(null);
frame.setVisible(true);
}
}

 

Penggunaan Table

 

package pertemuan3;
import javax.swing.*;
class FrameTabel2  {
public static void main(String args[]){
JFrame f= new JFrame();
String[] header={“Senin”,”Selasa”,”Rabu”};
String[][] data={{“100″,”300″,”150”},{“500″,”600″,”450”},{“290″,”690″,”360”}};
JTable tabel1=new JTable(data,header);
JScrollPane scrollPane = new JScrollPane(tabel1);
f.setTitle(“Frame Tabel”);
f.setLocation(200,100);
f.setSize(300,100);
f.add(scrollPane);
f.setVisible(true);
}
}

%d bloggers like this: