Example usage for javax.swing JTable JTable

List of usage examples for javax.swing JTable JTable

Introduction

In this page you can find the example usage for javax.swing JTable JTable.

Prototype

public JTable() 

Source Link

Document

Constructs a default JTable that is initialized with a default data model, a default column model, and a default selection model.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTable table = new JTable();

    if (table.getColumnSelectionAllowed() && !table.getRowSelectionAllowed()) {

        int[] vColIndices = table.getSelectedColumns();
    }/*from w w w  .  ja  va 2s.c o m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTable table = new JTable();

    if (!table.getColumnSelectionAllowed() && table.getRowSelectionAllowed()) {
        // //from  w w w.j a va 2 s  .  co  m
        int[] rowIndices = table.getSelectedRows();
    }
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    // Enable row selection (default)
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);/*from   www . j ava 2s .c o  m*/

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    table.setGridColor(Color.red);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    int gapWidth = 10;
    int gapHeight = 4;
    table.setIntercellSpacing(new Dimension(gapWidth, gapHeight));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    Dimension d = table.getIntercellSpacing();
    // d.width == 1, d.height == 1

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JTable table = new JTable();

    Dimension d = table.getIntercellSpacing();
    // d.width == 1, d.height == 1

    //Add 5 spaces to the left and right sides of a cell

    int gapWidth = 10;
    int gapHeight = 4;
    table.setIntercellSpacing(new Dimension(gapWidth, gapHeight));
}