Example usage for javax.swing JTable setFocusable

List of usage examples for javax.swing JTable setFocusable

Introduction

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

Prototype

public void setFocusable(boolean focusable) 

Source Link

Document

Sets the focusable state of this Component to the specified value.

Usage

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.setFocusable(false);

    table.setCellSelectionEnabled(false);

}

From source file:Main.java

/**
 * Disable any selections on a table./*from w  w w. ja  va2  s  .co m*/
 */
public static void disableSelection(JTable table) {
    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);
    table.setCellSelectionEnabled(false);
    table.setFocusable(false);
}