Java Jtable and adding rows dynamically | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Java Jtable and adding rows dynamically

My java code has 3 components : 1)rendering column to change to button 2) adding rows dynamically to the table by using "ADD ROW button" 3) the dynamically add button name is "Edit ", the number of rows is as we want.... here my question is based on the button editor " ButtonEditor" class the action liststener is called here ,in order to open another frame. but i want each row in of "Edit" to open different frame. any idea please? thanks, Here is fraction of my java code: part-1 this.tableau1.getColumn("Edit").setCellRenderer(new ButtonRenderer()); this.tableau1.getColumn("Edit").setCellEditor(new ButtonEditor(new JCheckBox())); part-2 class MoreListener1 implements ActionListener { int count=0; public void actionPerformed(ActionEvent event) { Object[] donnee = new Object[] {"class"+count++,st, "Edit", supp}; ((ZZModel)tableau1.getModel()).addRow(donnee); } } Part-3 public ButtonEditor(JCheckBox checkBox) { super(checkBox); button = new JButton(); button.setOpaque(true); button.addActionListener(bListener); button.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) { Fenetre fen = new Fenetre(); int count1=fen.countZZ; String value1=fen.value; Object Coo=HidingAndCooprationCombo.Coo; Object Hid=HidingAndCooprationCombo.Hid; //Object Coo2=HidingAndCooprationCombo.Coo2; //String x=z.tableChanged(null); // Fentere f= new Fentere(); // int count2=Fentere.count2; HidingAndCooprationCombo frame2= new HidingAndCooprationCombo(value1,count1,Coo,Hid); frame2.C(); }}); }

19th Jul 2019, 5:53 PM
abraha Tekulu
abraha Tekulu - avatar
1 Answer
0
Maybe, is it possible in python or c language.
26th Jul 2019, 4:30 AM
Siyam
Siyam - avatar