Package javax.swing

Examples of javax.swing.DefaultListModel.removeAllElements()


      // We must be careful to only interact with Swing components on the Swing event thread.
      EventQueue.invokeLater(new Runnable() {
        public void run () {
          cardLayout.show(getContentPane(), "chat");
          DefaultListModel model = (DefaultListModel)nameList.getModel();
          model.removeAllElements();
          for (String name : names)
            model.addElement(name);
        }
      });
    }
View Full Code Here


    public void setNames (final String[] names) {
      EventQueue.invokeLater(new Runnable() {
        public void run () {
          cardLayout.show(getContentPane(), "chat");
          DefaultListModel model = (DefaultListModel)nameList.getModel();
          model.removeAllElements();
          for (String name : names)
            model.addElement(name);
        }
      });
    }
View Full Code Here

          }
        } else {
          StringCountRecord[] recs = statistic
              .getRecords(Statistic.MAP_BITRATE);
          Arrays.sort(recs, NUMBER_SORTER);
          listModel.removeAllElements();
          for (int i = 0; i < recs.length; i++) {
            listModel.addElement(recs[i]);
          }
        }
        list.repaint();
View Full Code Here

                        // We must be careful to only interact with Swing components on the Swing event thread.
                        EventQueue.invokeLater(new Runnable() {
                                public void run () {
                                        cardLayout.show(getContentPane(), "chat");
                                        DefaultListModel model = (DefaultListModel)nameList.getModel();
                                        model.removeAllElements();
                                        for (String name : names)
                                                model.addElement(name);
                                }
                        });
                }
View Full Code Here

    DefaultListModel m1 = new DefaultListModel();   
    MyListDataListener listener = new MyListDataListener();
    m1.addListDataListener(listener);
    m1.addElement("A");
    m1.addElement("B");
    m1.removeAllElements();
    harness.check(m1.isEmpty());
    ListDataEvent event = listener.getEvent();
    harness.check(event.getType(), ListDataEvent.INTERVAL_REMOVED);
    harness.check(event.getIndex0(), 0);
    harness.check(event.getIndex1(), 1);
View Full Code Here

    harness.check(event.getType(), ListDataEvent.INTERVAL_REMOVED);
    harness.check(event.getIndex0(), 0);
    harness.check(event.getIndex1(), 1);
    listener.setListDataEvent(null);
   
    m1.removeAllElements();
    harness.check(m1.isEmpty());
    harness.check(listener.getEvent(), null);
  }

}
View Full Code Here

    public void setNames (final String[] names) {
      EventQueue.invokeLater(new Runnable() {
        public void run () {
          cardLayout.show(getContentPane(), "chat");
          DefaultListModel model = (DefaultListModel)nameList.getModel();
          model.removeAllElements();
          for (String name : names)
            model.addElement(name);
        }
      });
    }
View Full Code Here

            @Override
            protected boolean initControls () {
                // If the connection has been changed since the tables were fetched, rebuild the list.
                DefaultListModel tableListModel = (DefaultListModel) tableList.getModel();
                if (!connectionForTables.equals(wizardState.connectionGemName)) {
                    tableListModel.removeAllElements();
                    wizardState.tables.clear();
                }

                // Populate the table list, if necessary.
                if (tableListModel.isEmpty()) {
View Full Code Here

                break;
            case AgentopiaConstants.ACTION_HOST_STOPPED :
                getServiteurComboBox().insertItemAt("Host not running", 0);
                getServiteurComboBox().setEnabled(false);
                getServiteurAddButton().setEnabled(false);
                listModel.removeAllElements();
                break;
        }
    }

}
View Full Code Here

                break;
            case AgentopiaConstants.ACTION_HOST_STOPPED :
                getAgentComboBox().insertItemAt("Host not running", 0);
                getAgentComboBox().setEnabled(false);
                getAgentAddButton().setEnabled(false);
                listModel.removeAllElements();
                break;
        }
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.