Skip to content

CellEditor CellRenderer

Display a JProgressBar in a JTable cell.

TableCellProgressBar

Use a JProgressBar in a JTable cell to display the progress.

Add a JButton to a JTable cell and delete the row.

Section titled “Add a JButton to a JTable cell and delete the row.”
Add a JButton to a JTable cell and delete the row.

DeleteButtonInCell

Add a JButton to a JTable cell, and when clicked, delete that row.

Place multiple JButtons in a JTable cell.

MultipleButtonsInTableCell

Place multiple clickable JButtons within the cells of a JTable.

Place a JRadioButton inside a JTable cell.

Section titled “Place a JRadioButton inside a JTable cell.”
Place a JRadioButton inside a JTable cell.

RadioButtonsInTableCell

Place multiple JRadioButtons within a JTable cell.

Place multiple JCheckBoxes in a JTable cell.

Section titled “Place multiple JCheckBoxes in a JTable cell.”
Place multiple JCheckBoxes in a JTable cell.

CheckBoxesInTableCell

Place multiple JCheckBoxes within the cells of a JTable.

Set JComboBox to JTable's CellRenderer

ComboCellRenderer

We will use JComboBox as the CellRenderer for JTable.

Set a JComboBox in the CellEditor of a JTable.

Section titled “Set a JComboBox in the CellEditor of a JTable.”
Set a JComboBox in the CellEditor of a JTable.

ComboCellEditor

We will use a JComboBox in the JTable's CellEditor to allow the user to select a value from a list.

Display a JCheckBox in a JTable cell and change the row background color.

Section titled “Display a JCheckBox in a JTable cell and change the row background color.”
Display a JCheckBox in a JTable cell and change the row background color.

CheckedRowColor

If a JCheckBox displayed in a JTable cell is checked, the background color of that row will be changed.

Using JSlider for JTable’s CellEditor and CellRenderer

Section titled “Using JSlider for JTable’s CellEditor and CellRenderer”
Using JSlider for JTable's CellEditor and CellRenderer

SliderInTableCell

Configure the JTable's CellEditor and CellRenderer to use JSlider.

Change the date using JSpinner instead of CellEditor.

Section titled “Change the date using JSpinner instead of CellEditor.”
Change the date using JSpinner instead of CellEditor.

DateCellEditor

In JTable, change the cell editor for the column displaying the date to JSpinner.

Change the layout of the TableCellEditor

CellEditorLayout

Change the layout of the TableCellEditor to place a JButton next to the CellEditor.

Use a larger cell editor to edit JTables.

LargeCellEditor

Edit the JTable using a cell editor designed for selecting icons larger than the cells themselves, rather than the standard cell editor.

Change the border of the CellEditor

CellEditorBorder

Set the JTextField with the modified border as the default cell editor for the JTable.

Wrap text according to the cell width of the JTable

Section titled “Wrap text according to the cell width of the JTable”
Wrap text according to the cell width of the JTable

TableCellRenderer

This code wraps text to fit the cell width of the JTable.

Automatically adjust the height of JTable cells.

Section titled “Automatically adjust the height of JTable cells.”
Automatically adjust the height of JTable cells.

AutoWrapTableCell

The height of JTable cells will be automatically adjusted according to text wrapping.

Displaying Hyperlinks in JTable cells

HyperlinkInTableCell

This displays a hyperlink within a JTable cell.

Clipping HTML-modified strings

ClippedHtmlLabel

Modifying a string in HTML prevents it from being clipped, so create a clipped string beforehand before using HTML.

Section titled “Make only links within JTable cells hoverable.”
Make only links within JTable cells hoverable.

PointInsidePrefSize

This setting will only trigger a hover effect when the cursor hovers over an internal link within the JTable, rather than within a cell itself.

Edit JTable cells with a single click.

SingleClickCellEdit

This sets up a JTable so that a single click with the mouse puts it into edit mode.

Highlighting cells in a JTable

CellHighlight

This changes the background color of a JTable cell when the mouse cursor is over it.

Set JPopupMenu in the JTable cell editor.

CellEditorPopupMenu

Set up a JPopupMenu in the JTable's cell editor to perform actions such as Copy, Paste, Undo, and Redo.

Roll over a JCheckBox cell.

RolloverBooleanRenderer

This setting allows you to configure JCheckBoxes to roll over with the mouse cursor even when using them in JTable cells.

Change the background color of the BooleanCellEditor used by JTable.

Section titled “Change the background color of the BooleanCellEditor used by JTable.”
Change the background color of the BooleanCellEditor used by JTable.

BooleanCellEditor

This changes the background color of the BooleanCellEditor used by JTable by default to the selected color.

Display only two rows within a JTable cell.

Section titled “Display only two rows within a JTable cell.”
Display only two rows within a JTable cell.

TwoRowsCellRenderer

This code displays text in a JTable cell for two lines, truncating any overflow with '...'.

Make the TableCellEditor scrollable.

ScrollingCellEditor

We will use JTextArea and JScrollPane as TableCellEditors for the JTable.

Add padding to the JComboBox set in the JTable’s CellEditor.

Section titled “Add padding to the JComboBox set in the JTable’s CellEditor.”
Add padding to the JComboBox set in the JTable's CellEditor.

ComboBoxCellEditorInsets

This adds padding to the JComboBox set in the JTable's CellEditor.

Using EnumSet for JTable columns

EnumSet

This code sets an EnumSet to a column in a JTable and displays its state using a renderer that utilizes a JCheckBox.

Use the Renderer for the column headers in the row headers of a JTable.

Section titled “Use the Renderer for the column headers in the row headers of a JTable.”
Use the Renderer for the column headers in the row headers of a JTable.

RowHeaderStyle

The renderer of the column header obtained from the JTableHeader is applied to the rendering of the JTable rows.

Connect JTable cells horizontally.

ColumnSpanningCellRenderer

This creates a cell renderer that concatenates JTable cells horizontally.

Highlight the search results in the JTable using RowFilter and Highlighter.

Section titled “Highlight the search results in the JTable using RowFilter and Highlighter.”
Highlight the search results in the JTable using RowFilter and Highlighter.

TableHighlightRegexFilter

In a JTable, we will display search results based on regular expressions using RowFilter and Highlighter.

Create a property list using JTable

PropertyTable

A property list table is created by applying a cell editor appropriate to the class to each row of the JTable.

Use a JProgressBar with a progress string set in a TableCellRenderer.

Section titled “Use a JProgressBar with a progress string set in a TableCellRenderer.”
Use a JProgressBar with a progress string set in a TableCellRenderer.

StringPaintedCellProgressBar

Set JProgressBar as the TableCellRenderer for the JTable to display the progress string.

Setting the alignment when displaying multi-line HTML text in a TableCellRenderer.

Section titled “Setting the alignment when displaying multi-line HTML text in a TableCellRenderer.”
Setting the alignment when displaying multi-line HTML text in a TableCellRenderer.

HtmlCellVerticalAlignment

This test examines how line alignment affects rendering when displaying multi-line HTML text in a JTable cell.

Place multiple components in a JTable’s CellEditor using JPanel

Section titled “Place multiple components in a JTable’s CellEditor using JPanel”
Place multiple components in a JTable's CellEditor using JPanel

PanelCellEditorRenderer

By using JPanel in the JTable's CellEditor and CellRenderer, you can place multiple components inside the cell and add padding.

Make only JCheckBoxes inside JTable cells clickable.

Section titled “Make only JCheckBoxes inside JTable cells clickable.”
Make only JCheckBoxes inside JTable cells clickable.

CheckBoxCellEditor

Set a JCheckBox placed in the center of the JPanel as the cell editor for the JTable, and configure it so that the selection state changes only when the JCheckBox is clicked.

Align text within JTable cells to both ends.

Section titled “Align text within JTable cells to both ends.”
Align text within JTable cells to both ends.

InterIdeographJustify

This sets the text placed within a JTable cell to justify its alignment.

Set a JComboBox with hidden ArrowButtons in the CellEditor of a JTable.

Section titled “Set a JComboBox with hidden ArrowButtons in the CellEditor of a JTable.”
Set a JComboBox with hidden ArrowButtons in the CellEditor of a JTable.

NoArrowButtonComboCellEditor

We will use a JComboBox with the ArrowButton hidden as the CellEditor for the JTable.

Aligning decimal points within JTable cells

Section titled “Aligning decimal points within JTable cells”
Aligning decimal points within JTable cells

AlignDecimalCellRenderer

We use a JTextPane with TabSet configured as the cell renderer for the JTable, and align the decimal points of the numbers.

Configure the JComboBox cell editor so that the dropdown list is not displayed immediately after editing begins.

Section titled “Configure the JComboBox cell editor so that the dropdown list is not displayed immediately after editing begins.”
Configure the JComboBox cell editor so that the dropdown list is not displayed immediately after editing begins.

CellEditorTogglePopup

When a JComboBox is set as the cell editor for a JTable, and editing of that cell begins, the dropdown list will not be displayed immediately; instead, the cell will be in a selected state.

Use an editable JComboBox as the cell editor for a JTable.

Section titled “Use an editable JComboBox as the cell editor for a JTable.”
Use an editable JComboBox as the cell editor for a JTable.

EditableComboCellEditor

Apply an editable JComboBox as a cell editor for the JTable, allowing you to add cell values ​​and perform other actions.

In JTables, cells with the same content are displayed as blank to represent grouping.

Section titled “In JTables, cells with the same content are displayed as blank to represent grouping.”
In JTables, cells with the same content are displayed as blank to represent grouping.

RowGroupInTable

In a JTable, cells with the same content as the cell directly above them are displayed as blank to represent row grouping.

Draw JTable cell borders using MatteBorder.

Section titled “Draw JTable cell borders using MatteBorder.”
Draw JTable cell borders using MatteBorder.

SudokuTableBorder

By drawing the cell borders of the JTable using MatteBorder, the thickness of the 3x3 block borders is changed.

Highlight text within JTable cells using HTML tags

Section titled “Highlight text within JTable cells using HTML tags”
Highlight text within JTable cells using HTML tags

TableCellHtmlHighlighter

This code highlights text within JTable cells using HTML tags.

Enable tab key focus movement within the JTable cell editor.

Section titled “Enable tab key focus movement within the JTable cell editor.”
Enable tab key focus movement within the JTable cell editor.

CellEditorFocusCycle

This setting allows you to move focus within the cell editor using the Tab key when a JTable is being edited.

Validate input to the JTable cell editor.

CellEditorInputVerifier

Use InputVerifier or similar tools to verify whether the input to the JTable cell editor is valid.

Change the JTable’s CellEditor to be non-editable but allow selection and copying.

Section titled “Change the JTable’s CellEditor to be non-editable but allow selection and copying.”
Change the JTable's CellEditor to be non-editable but allow selection and copying.

NonEditableCellEditor

Set a JTextField as the CellEditor for the JTable; this will be non-editable but selectable and copyable.

Divide a JTable cell diagonally.

DiagonallySplitCellCalendar

We'll use JLayer to draw straight lines on the JTable's cell renderer to display diagonally divided cells.

Resizing the checkbox icon in JCheckBox.

ScaledIcon

This resizes the checkbox icons of JCheckBoxes set in the JTable's cell editor and cell renderer according to the row height of the JTable.

Section titled “Display JTableHeaders as links and disable clicking on cell margins.”
Display JTableHeaders as links and disable clicking on cell margins.

HyperlinkHeaderCellRenderer

This setting displays the column text of the JTableHeader as a link, and prevents column sorting from being performed when clicking on the blank space within the cell other than the link.

Click the JCheckBox placed within a JTable cell to expand or collapse the row height.

Section titled “Click the JCheckBox placed within a JTable cell to expand or collapse the row height.”
Click the JCheckBox placed within a JTable cell to expand or collapse the row height.

TableCellExpandCollapseOnClick

A JCheckBox is placed inside a JTable cell, and when clicked, the row height expands to the recommended size of the adjacent cell.

When renaming is initiated in the JFileChooser cell editor, the file name excluding the extension is selected.

Section titled “When renaming is initiated in the JFileChooser cell editor, the file name excluding the extension is selected.”
When renaming is initiated in the JFileChooser cell editor, the file name excluding the extension is selected.

SelectFileNameWithoutExtension

This code retrieves the JTextField used as a renameable cell editor in the ListView or DetailsView of the JFileChooser, and sets it so that the file name excluding the extension, rather than the entire file name, is selected.

Display an uncertain progress status JProgressBar in a JTable cell.

Section titled “Display an uncertain progress status JProgressBar in a JTable cell.”
Display an uncertain progress status JProgressBar in a JTable cell.

TableCellOfIndeterminateProgressBar

This code applies a JProgressBar to the cells of a JTable, which displays an animation indicating an uncertain progress state for a set period of time.

Change the background drawing of selected rows in a JTable to a rounded rectangle.

Section titled “Change the background drawing of selected rows in a JTable to a rounded rectangle.”
Change the background drawing of selected rows in a JTable to a rounded rectangle.

RoundedCornerTableRowSelection

The JTable's row selection background is drawn with rounded corners using the TableCellRenderer of the first and last cells so that the entire row appears as a rounded rectangle.

When you start editing a JTable cell, scroll until the entire cell editor is displayed.

Section titled “When you start editing a JTable cell, scroll until the entire cell editor is displayed.”
When you start editing a JTable cell, scroll until the entire cell editor is displayed.

ScrollCellEditorToVisible

This setting allows you to configure JTable to scroll to a position where the entire cell editor is visible when cell editing begins via key input.

Use the calendar created in the JTable as the date cell editor for the JTable.

Section titled “Use the calendar created in the JTable as the date cell editor for the JTable.”
Use the calendar created in the JTable as the date cell editor for the JTable.

DateChooserCellEditor

By placing a calendar created with JTable into JPopupMenu and using it as a cell editor for the JTable's Date field, you can select and change dates.