HOw can i assign a default action of Enter key after cell of jtable is edited to a Button???

Recommended Answers

All 2 Replies

Not sure this is what you want. Your question isn't very well explained.

public void actionPerformed(ActionEvent e) {

    if(e.getSource() == JTable()) {
        JButton.doClick();
    }
}

It seems that you are referring to a how to control the cell.

For this you will either have write your cell editor or override the DefaulCellEditor which is usually added to cells.

Add a keylistener to the editor component where you would be able to listen to the enterkey.

Try this out and if you are stuck midway would be happy to help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.