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(final Object[][] rowData, final Object[] columnNames) 

Source Link

Document

Constructs a JTable to display the values in the two dimensional array, rowData, with column names, columnNames.

Usage

From source file:Main.java

public static void main(String[] argv) {
    // Create a table with 10 rows and 5 columns
    JTable table = new JTable(10, 5);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);
    table.getModel().setValueAt("New Value", 0, 0);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);

    table.setValueAt("New Value", 0, 0);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);

    table.getTableHeader().setResizingAllowed(false);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.moveColumn(table.getColumnCount() - 1, 0);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);

    Object o = table.getModel().getValueAt(1, 1);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    // /*from  ww  w. j a  va 2 s.com*/
    table.selectAll();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);

    int rowIndex = 1;
    int vColIndex = 2;
    Object o = table.getValueAt(rowIndex, vColIndex);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);

    table.getTableHeader().setReorderingAllowed(false);

    table.moveColumn(table.getColumnCount() - 1, 0);

}

From source file:Main.java

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

    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    int rowIndex = table.getSelectionModel().getAnchorSelectionIndex();
    int vColIndex = table.getColumnModel().getSelectionModel().getAnchorSelectionIndex();
}