خرید بک لینک

Vote count: 0

I need help populating the Jlist correctly. When I press the >> button it should add the selected part from the left panel to the list of parts in the right panel. The << button should delete the selected part from the right panel. Im pretty sure Im not using a method correctly.

//This Add_1 button adds the selected part from the left panel to the list of parts in the right panel.

Add_1.addActionListener(new ActionListener() {

        @SuppressWaings("unused")
        public void actionPerformed(java.awt.event.ActionEvent evt) {

            DefaultListModel model1 = new DefaultListModel();

            for(int i = 0; i < list.getModel().getSize(); i++)
            {

                Object item = list.getModel().getElementAt(i);

                model1.addElement(item);
                list_1.setModel(model1);

            }

        }

    });

enter image description here //delete button

btnNewButton_1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {

            DefaultListModel model2 = new DefaultListModel();
            model2.addElement(list_1.getSelectedValue());
            list.setModel(model2);
            }
        });

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 29 ارديبهشت 1395 ساعت: 11:57

صفحه بندی