JTextField with JTable
Hello, im trying to put textfield in a cell of Jtable but appears the following text inside of JTextField that i've inserted...
javax.swing.JTextField[,0,0,0x0,invalid,disabled,layout=javax.swing.plaf.basic.Basic
TextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.Border
UIResource$CompoundBorderUIResource@196c1b0,flags=296,maximumSize=,minimumSize
=,preferredSize=,caretColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],disabled
TextColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],editable=true,margin=
javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],selectedTextColor=
sun.swing.PrintColorUIResource[r=51,g=51,b=51],selectionColor=javax.swing.plaf.Color
UIResource[r=184,g=207,b=229],columns=0,columnWidth=0,command=,horizontal
Alignment=LEADING]
Thus i've implemented a class FBaseTableCellEditor extends DefaultCellEditor that allow me to have JTextfield like cell of JTable.
this is the source code :
public class FBaseTableCellEditor extends DefaultCellEditor {
public FBaseTableCellEditor() {
super(new javax.swing.JTextField());
this.editorComponent = new javax.swing.JTextField();
//this.setClickCountToStart(1);
}
}
ths is the source code to insert a new row in the JTable:
private void AddRowsinTable(){
int row = JTable.getRowCount() - 1;
JTextField[] newrow = CreateRow();
this.DefaultTableModel.addRow(newrow);
}
private JTextField[] CreateRow()
{
JTextField[] newrow = {this.JTextField0, this.JTextField1, this.JTextField2, this.JTextField3, this.JTextField4, this.JTextField5, this.JTextField6};
return newrow;
}

