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...

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));

JTable knows JComboBox as Renderer or Editor too, better would be read tutorial that contains JComboBox in JTable

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.