Tempat Berbagi Ilmu dan Pengalaman

Blog ini menampilkan berbagai artikel artikel yang dapat menambah pengetahuan dan membantu para mahasiswa untuk meningkatkan pengetahuan dan membantu tugas kuliah

J Table

CONTOH PROGRAM JTABLE DENGAN BLUE J




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

public class ContohJTable extends JFrame
{
    public static void main (String []args)
    {
        ContohJTable apl = new ContohJTable ();
    }
    public ContohJTable ()
    {
        super ("Tes JTable");
        setSize (400,150);
       
        Object data [] [] = {
            {"11234","Astri Damayanti","Akunting", new Long(2200000)},
            {"11235","Eritria","Pemasaran", new Long(1200000)},
            {"11236","Satria","Personalia", new Long(1200000)},
            {"11237","Tri Setyowati","EDP", new Integer(1500000)},
            {"11238","Fahmi Basya","Akunting", new Long(10000000)},
            {"11239","Suadi Marwan","Akunting", new Long(1100000)},
            {"11241"," Listya","Pemasaran", new Long(1100000)},
        };
       
        String [] judulKolom ={"NIP","Nama","Bagian","Gaji"};
        JTable tabel = new JTable(data, judulKolom);
        JScrollPane scrollpane = new JScrollPane(tabel);
        tabel.setPreferredScrollableViewportSize
        (new Dimension(300,50));
       
        getContentPane().add(scrollpane);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
        //--- Tampilkan frame
        show();
    }
}








OUTPUT:


           

0 komentar :