create JTable - Java Swing

Java examples for Swing:JTable

Description

create JTable

Demo Code


//package com.java2s;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;

public class Main {
    public static JTable createTable(JTable table, DefaultTableModel model) {
        model = new DefaultTableModel();
        model.addColumn("First Name");
        model.addColumn("Last Name");
        model.addColumn("Email");
        model.addColumn("Date of Birth");
        table = new JTable(model);
        table.setFillsViewportHeight(true);
        return table;
    }/*from w  ww.j  a  v  a  2s . co  m*/
}

Related Tutorials