How to add row of data to Jtable from values received from jtextfield and comboboxes

后端 未结 3 395
感情败类
感情败类 2021-02-01 23:57

I have a JFrame Form which has JTextFields, JCombobox etc. and I am able to receive those values to variables and now I want to add the re

3条回答
  •  终归单人心
    2021-02-02 00:21

    String[] tblHead={"Item Name","Price","Qty","Discount"};
    DefaultTableModel dtm=new DefaultTableModel(tblHead,0);
    JTable tbl=new JTable(dtm);
    String[] item={"A","B","C","D"};
    dtm.addRow(item);
    

    Here;this is the solution.

提交回复
热议问题