简体   繁体   中英

table with buttons

I want to create a column and install a button in this last column in this table.

   public JPanel pinakas(String[] pinaka) {
        int sr = 0;
        //int ari8mos  =0;

        String[] COLUMN_NAMES = {"Κωδικός", "Ποσότητα", "Τιμή", "Περιγραφή", "Μέγεθος", "Ράτσα"};
//pio panw mporoume na pros8esoume ws prwto column to "#", wste na deixnei ton ari8mo ths ka8e kataxwrhshs
        DefaultTableModel modelM = new DefaultTableModel(COLUMN_NAMES, 0);
        JTable tableM = new JTable(modelM);
        JPanel mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(new JScrollPane(tableM), BorderLayout.CENTER);

        Display disp = new Display();
        while (pinaka[sr] != null) // !!!!tha ektupwsei kai mia parapanw "/n" logo ths kataxwrhshs prwtou h teleytaiou mahmatos
        {
            String[] temp5 = disp.lineDelimiter(pinaka[sr],6, "#");
            Object[] doge = { temp5[0], temp5[1], temp5[2], temp5[3], temp5[4], temp5[5]};//edw mporoume sthn arxh na valoume to ari8mos gia na fainetai o ari8mos twn kataxwrhsewn
            modelM.addRow(doge);
            sr++;
            //ari8mos++;
        }

        return mainPanel;
    }

表格按钮列显示了一种可能的解决方案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM