can anyone tell me how to bring jbutton within a jtable.........and how do do the actionperform of the button

can i do this in jframe......

Edited 5 Years Ago by Jessurider: n/a

as @JamesCherrill mentioned you have to look for Rendered, but that only to display JButton in the JTable, for invoke + Listening expected Action you have to look at TebleCellEditor, that very easy for JComponents as JButton, JComboBox, JtextField, JFormattedTextField, another JComponents required more of ..., examples here and here

I haven't tried this myself, so no promises, but... I think if you use a JButton (or a subclass thereof) as the renderer then you get a real JButton in that cell, and you can add a normal ActionListener to the JButton just like to any other JButton.

@JamesCherrill then that isn't possible (without TableModelLister with ListSelectionListener and some moreover dirty woodoo) get TableCoulmn&Row from Action came, I have 1000 ideas how that never ever works correctly, 2-3 where with success

1.st with

prepareEditor

,

2.nd with

DefaultCellEditor ButtonEditor = new efaultCellEditor(JComponents)

last with

class Button extends AbstractCellEditor implements TableCellEditor

no way for me with StandAlone Renderer

Edited 5 Years Ago by mKorbel: n/a

@JamesCherrill then that isn't possible... get TableCoulmn&Row from Action came

The event source will be the specific button. If that's not clear enough (depending on the application), you could add the row/col to the JButton's data when the button is created.

This article has been dead for over six months. Start a new discussion instead.