SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

SWING / NOTES</>↗
Swing21 Sep 2010

How do I programmatically select JTable’s rows?

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 […]

Wayan · 3 min read
BASIC / NOTES</>↗
Basic20 Sep 2010

How do I handle exceptions using try-catch block?

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 […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing20 Sep 2010

How do I set the JTable’s selection mode?

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...

Wayan · 2 min read
SWING / NOTES</>↗
Swing20 Sep 2010

How do I allow row or column selection in JTable?

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 […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing19 Sep 2010

How do I set or change JTable column width?

Each column of a JTable component is represented by the TableColumn class. The method for setting or changing the width of the column includes the setMinWidth(), setMaxWidth() and setPreferredWidth(). These methods are used to set the minimum, maximum and the preferred width of the column respectively. When we set only the preferred width of a […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing19 Sep 2010

How do I create a table model for JTable component?

Another way to create and configure a JTable component is using a table model. A table model is more preferred to using array or vector as the data source for the table. The simplest way to create a table model is by extending the AbstractTableModel abstract class which implements the TableModel interface. The AbstractTableModel implements […]

Wayan · 3 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.