Java Code Examples for javax.swing.DefaultListModel#addListDataListener()

The following examples show how to use javax.swing.DefaultListModel#addListDataListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PathsCustomizer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void setModels(final DefaultListModel mpModel, final DefaultListModel cpModel) {
    this.model = new JoinModel(mpModel, cpModel);
    this.list.setModel(this.model);
    DefaultTreeModel mpTreeModel = toTreeModel(mpModel, MODULEPATH);
    DefaultTreeModel cpTreeModel = toTreeModel(cpModel, CLASSPATH);
    mpModel.addListDataListener(new ListModelListener(mpModel, mpTreeModel, mpTree));
    cpModel.addListDataListener(new ListModelListener(cpModel, cpTreeModel, cpTree));
    mpTree.setModel(mpTreeModel);
    cpTree.setModel(cpTreeModel);
    SelectionModel mpTreeSelectionModel = new SelectionModel();
    SelectionModel cpTreeSelectionModel = new SelectionModel();
    mpTreeSelectionModel.addTreeSelectionListener(new SelectionListener(mpTreeModel, this.list, null, cpTreeSelectionModel));
    cpTreeSelectionModel.addTreeSelectionListener(new SelectionListener(cpTreeModel, this.list, mpModel, mpTreeSelectionModel));
    mpTree.setSelectionModel(mpTreeSelectionModel);
    cpTree.setSelectionModel(cpTreeSelectionModel);
}
 
Example 2
Source File: PathsCustomizer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void setModels(final DefaultListModel mpModel, final DefaultListModel cpModel) {
    this.model = new JoinModel(mpModel, cpModel);
    this.list.setModel(this.model);
    DefaultTreeModel mpTreeModel = toTreeModel(mpModel, MODULEPATH);
    DefaultTreeModel cpTreeModel = toTreeModel(cpModel, CLASSPATH);
    mpModel.addListDataListener(new ListModelListener(mpModel, mpTreeModel, mpTree));
    cpModel.addListDataListener(new ListModelListener(cpModel, cpTreeModel, cpTree));
    mpTree.setModel(mpTreeModel);
    cpTree.setModel(cpTreeModel);
    SelectionModel mpTreeSelectionModel = new SelectionModel();
    SelectionModel cpTreeSelectionModel = new SelectionModel();
    mpTreeSelectionModel.addTreeSelectionListener(new SelectionListener(mpTreeModel, this.list, null, cpTreeSelectionModel));
    cpTreeSelectionModel.addTreeSelectionListener(new SelectionListener(cpTreeModel, this.list, mpModel, mpTreeSelectionModel));
    mpTree.setSelectionModel(mpTreeSelectionModel);
    cpTree.setSelectionModel(cpTreeSelectionModel);
}
 
Example 3
Source File: PathController.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of PathController */
public PathController(JList l, JLabel label, DefaultListModel model, JButton add, JFileChooser chooser, JButton remove, JButton up, JButton down, ListDataListener lstnr) {
    this.l = l;
    this.label = label;
    this.model = model;
    this.add = add;
    this.remove = remove;
    this.up = up;
    this.down = down;
    this.chooser = chooser;

    this.lstnr = lstnr;

    l.setModel(model);
    if (model != null) {
        model.addListDataListener(this);
    }
    add.setActionCommand("add");// NOI18N
    remove.setActionCommand("remove");// NOI18N
    up.setActionCommand("up");// NOI18N
    down.setActionCommand("down");// NOI18N
    add.addActionListener(this);
    remove.addActionListener(this);
    up.addActionListener(this);
    down.addActionListener(this);
    l.addListSelectionListener(this);

    remove.setEnabled(false);
    up.setEnabled(false);
    down.setEnabled(false);
}
 
Example 4
Source File: ClassPathTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ClassPathTableModel(DefaultListModel model) {
    super();
    this.model = model;
    model.addListDataListener(this);
}
 
Example 5
Source File: AdditionalContentTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public AdditionalContentTableModel(DefaultListModel model) {
    super();
    this.model = model;
    model.addListDataListener(this);
}
 
Example 6
Source File: ClassPathTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ClassPathTableModel(DefaultListModel model) {
    super();
    this.model = model;
    model.addListDataListener(this);
}
 
Example 7
Source File: WarIncludesTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public WarIncludesTableModel(DefaultListModel model) {
    super();
    this.model = model;
    model.addListDataListener(this);
}
 
Example 8
Source File: FormBeanPropertiesPanelVisual.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public PropertiesTableModel() {
    model = new DefaultListModel();
    model.addListDataListener(this);
}
 
Example 9
Source File: ClassPathTableModel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ClassPathTableModel(DefaultListModel model) {
    super();
    this.model = model;
    model.addListDataListener(this);
}