Package javax.swing

Examples of javax.swing.DefaultListModel.addElement()


    CellConstraints cc = new CellConstraints();

    DefaultListModel listModel = new DefaultListModel();
    mExclusionsList = new JList(listModel);
    for (Exclusion exclusion : exclusions) {
      listModel.addElement(exclusion);
    }
    mExclusionsList.setCellRenderer(new ExclusionListCellRenderer());
   
    mExclusionsList.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
View Full Code Here


    JPanel panelAdded = new JPanel(new BorderLayout());
    panelAdded.setBorder(BorderFactory.createTitledBorder(mLocalizer.msg("added", "New channels: {0}", mAddedList.size())));

    DefaultListModel listModel = new DefaultListModel();
    for (int i = 0; i < mAddedList.size(); i++) {
      listModel.addElement(mAddedList.get(i));
    }
    ChannelJList list = new ChannelJList(listModel);
    list.setCellRenderer(new ChannelListCellRenderer(true, true));

    panelAdded.add(new JScrollPane(list), BorderLayout.CENTER);
View Full Code Here

    JPanel panelDeleted = new JPanel(new BorderLayout());
    panelDeleted.setBorder(BorderFactory.createTitledBorder(mLocalizer.msg("deleted", "Removed channels: {0}", mDeletedList.size())));

    listModel = new DefaultListModel();
    for (int i = 0; i < mDeletedList.size(); i++) {
      listModel.addElement(mDeletedList.get(i));
    }
    list = new ChannelJList(listModel);
    list.setCellRenderer(new ChannelListCellRenderer(true, true));

    panelDeleted.add(new JScrollPane(list), BorderLayout.CENTER);
View Full Code Here

    Arrays.sort(availableChannelArr, createChannelComparator());

    DefaultListModel newModel = new DefaultListModel();
    // Add the available channels
    for (Channel anAvailableChannelArr : availableChannelArr) {
      newModel.addElement(anAvailableChannelArr);
    }
    mAllChannels.setModel(newModel);

    mRightButton.setEnabled(!newModel.isEmpty());
    mAllChannels.setEnabled(!newModel.isEmpty());
View Full Code Here

    public void actionPerformed(final ActionEvent e)
    {
      final DefaultListModel enumEntryListModel = getEnumEntryListModel();
      enumEntryListModel.clear();
      getEnumEntryEditField().setText(""); //$NON-NLS-1$
      enumEntryListModel.addElement("true"); //$NON-NLS-1$
      enumEntryListModel.addElement("false"); //$NON-NLS-1$
    }
  }

  /**
 
View Full Code Here

    {
      final DefaultListModel enumEntryListModel = getEnumEntryListModel();
      enumEntryListModel.clear();
      getEnumEntryEditField().setText(""); //$NON-NLS-1$
      enumEntryListModel.addElement("true"); //$NON-NLS-1$
      enumEntryListModel.addElement("false"); //$NON-NLS-1$
    }
  }

  /**
   * Handles the request to add a new enumeration entry to the detail editor.
View Full Code Here

        public void run () {
          cardLayout.show(getContentPane(), "chat");
          DefaultListModel model = (DefaultListModel)nameList.getModel();
          model.removeAllElements();
          for (String name : names)
            model.addElement(name);
        }
      });
    }

    public void addMessage (final String message) {
View Full Code Here

    public void addMessage (final String message) {
      EventQueue.invokeLater(new Runnable() {
        public void run () {
          DefaultListModel model = (DefaultListModel)messageList.getModel();
          model.addElement(message);
          messageList.ensureIndexIsVisible(model.size() - 1);
        }
      });
    }
  }
View Full Code Here

        public void run () {
          cardLayout.show(getContentPane(), "chat");
          DefaultListModel model = (DefaultListModel)nameList.getModel();
          model.removeAllElements();
          for (String name : names)
            model.addElement(name);
        }
      });
    }

    // The server calls this method as needed.
View Full Code Here

    // The server calls this method as needed.
    public void addMessage (final String message) {
      EventQueue.invokeLater(new Runnable() {
        public void run () {
          DefaultListModel model = (DefaultListModel)messageList.getModel();
          model.addElement(message);
          messageList.ensureIndexIsVisible(model.size() - 1);
        }
      });
    }
  }
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.