SWING / CATATAN</>↗Swing21 Sep 2010
Disables or enables JTable‘s cell selection can be done by calling the setCellSelectionEnabled(boolean cellSelectionEnabled) method. This method accept a boolean value. Calling this method also changes the state of table’s row and column selection respectively. To completely remove the selection capability from JTable component we can change its focusable state to false by calling the […]
SWING / CATATAN</>↗Swing21 Sep 2010
The following examples shows you how to get the selected rows or the selected columns or the selection of multiple cells in the JTable component. To listen for selection event we can add a selection listener to JTable component by calling the JTable.getSelectionModel().addListSelectionListener() method. This method accepts an object which implements a ListSelectionListener interface.` package […]
SWING / CATATAN</>↗Swing21 Sep 2010
This program shows you how to select some rows in the JTable programmatically. Below we demonstrate how to select rows using the setRowSelectionInterval() method, remove or clear row selection using removeRowSelectionInterval() method and use the addRowSelectionInterval() to add more rows to the previously selected rows. package org.kodejava.swing; import javax.swing.*; import javax.swing.table.AbstractTableModel; import java.awt.*; public class […]
BASIC / CATATAN</>↗Basic20 Sep 2010
An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program’s instructions. When an abnormal situation occurs within a method, an Exception object is thrown. This object contains information about the error or unusual problems that occur. Creating an exception object and handing it to […]
SWING / CATATAN</>↗Swing20 Sep 2010
There are three selection modes available in the JTable component. The selection mode can be a single selection, a single interval selection or a multiple interval selection. To set the selection mode we call the JTable.setSelectionMode() method and pass one of the following value as the parameter: ListSelectionModel.SINGLE_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION package org.kodejava.swing; import javax.swing.*; im...
SWING / CATATAN</>↗Swing20 Sep 2010
To allow a row selection or a column selection or both row and column selection in JTable component we can turn it on and off by calling the JTable‘s setRowSelectionAllowed() and JTable‘s setColumnSelectionAllowed() methods. Both of these methods accept a boolean value indicating whether the selection is allowed or not allowed. Setting both of them […]