Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextArea Editor in JTable  RSS feed

Anagha Medicharla
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want cells in JTable that takes multiline text. I have created two classes ,TextAreaEditor and TextAreaRenderer.I think there is a problem with TextAreaEditor class .When I type in one cell and go to other cell, conetent of previous cell disappears.
Cananybody help me out.
I have written the code as follows:
[code] class TextAreaEditor extends DefaultCellEditor {
protected JTextArea txt;
private String label;
public TextAreaEditor(JCheckBox checkBox) {
txt = new JTextArea();

public Component getTableCellEditorComponent(JTable table, Object value,boolean isSelected, int row, int column) {

label = (value ==null) ? "" : value.toString();
txt.setText( label );
return txt;
public Object getCellEditorValue() {
return new String( label ) ;
public boolean stopCellEditing() {
return super.stopCellEditing();
protected void fireEditingStopped() {
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!