下面列出了javax.swing.DefaultListModel#addListDataListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
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);
}
/** 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);
}
public ClassPathTableModel(DefaultListModel model) {
super();
this.model = model;
model.addListDataListener(this);
}
public AdditionalContentTableModel(DefaultListModel model) {
super();
this.model = model;
model.addListDataListener(this);
}
public ClassPathTableModel(DefaultListModel model) {
super();
this.model = model;
model.addListDataListener(this);
}
public WarIncludesTableModel(DefaultListModel model) {
super();
this.model = model;
model.addListDataListener(this);
}
public PropertiesTableModel() {
model = new DefaultListModel();
model.addListDataListener(this);
}
public ClassPathTableModel(DefaultListModel model) {
super();
this.model = model;
model.addListDataListener(this);
}