Hi,

Am finding 1 diffculty in jtable pls help me...


i want to set jtextfield value in jtable of particular column and also that jtextfield value will be dynamically changing... even i have tried the below code...

String   mn=jTextField2.getText();
 jTable3.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(mn));

but its not working...

Edited 4 Years Ago by peter_budo: Keep It Clear - Do use code tags when posting any code

for why reason(s) you needed that,

in the JTable is there by default JLabel, on CellEdit is there JTextField

for why reason(s) you needed that,

in the JTable is there by default JLabel, on CellEdit is there JTextField

------------------------------

Its Simple jtable only with 4 columns
Above the jtable there is 1 textfield for that textfield am reteriving value from database that i want to call in 0 column of the jtable

for column 1 & 2 i have setted the below code its working fine... but for column 0 that textfield value in setting..

String[] when = {"Select","111", "110","101","100","011","010" ,"001"};
        JComboBox combo = new JComboBox(when);
        jTable3.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(combo));

        String[] time = { "Select","AfterMeal", "BeforeMeal" };
        JComboBox com = new JComboBox(time);
        jTable3.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(com));

Edited 4 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

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