Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

We use a javax.swing.JTable.

Create it ...

using an instance of this inner class.

It extends javax.swing.table.AbstractTableModel, an abstract class, a class that is not complete, meaning that we HAVE TO define methods to make it usable.

This is exactly what we do in our inner class, so that it's complete and can be instantiated.

We handle mouse events on the table ...

by calling onetobeamdown in the mouseClicked method,...

where we determine which row and column are involved.

We retrieve the associated object...

by using our inner class' getValueAt method.

And copy its value to the textfield, if it's a String.

In case of an action event ( button-click/ textfield-enter ),...

we copy the textfield's string to the last-chosen table cell...

by using our inner class's setValueAt.

=========

NOTES

=========

JTable offers string-editing inside the cell, this example takes you one step further.

=========

A column can be dragged to another position by dragging its header. The column width can be changed by dragging the separator between column headers.

=========

We use only one picture for brevity's sake,...

but you get the picture.(Hah)

.