user
user

Reputation: 6797

JPanel in a cell of a JTable

How could I put a JPanel into a cell of a JTable?
(There would be a column what would contain String objects, and an other column with JPanel objects. )

Upvotes: 2

Views: 6996

Answers (2)

divjscr
divjscr

Reputation: 61

Actually you can do that by adding an editor to the data type that the panel covers

Upvotes: 0

Shahriar
Shahriar

Reputation: 290

http://download.oracle.com/javase/tutorial/uiswing/components/table.html#renderer

Read the part that talks about using Custom Renderers. The ColorRenderer example puts a JLabel in a cell. You could easily change that to use a JLabel instead.

Upvotes: 1

Related Questions