use of javax.swing.ListModel in project OpenAM by OpenRock.
the class ListJPanel method addCategory.
public void addCategory(ImageListEntry entry) {
ListModel model = categoryjList.getModel();
if (model instanceof DefaultListModel) {
((DefaultListModel) model).addElement(entry);
} else {
DefaultListModel newModel = new DefaultListModel();
newModel.addElement(entry);
categoryjList.setModel(newModel);
}
}
use of javax.swing.ListModel in project pcgen by PCGen.
the class EncounterPlugin method mouseClicked.
@Override
public void mouseClicked(MouseEvent evt) {
if (evt.getSource() == theView.getLibraryCreatures()) {
if (evt.getClickCount() == 2) {
int index = theView.getLibraryCreatures().locationToIndex(evt.getPoint());
ListModel dlm = theView.getLibraryCreatures().getModel();
Object item = dlm.getElementAt(index);
theView.getLibraryCreatures().ensureIndexIsVisible(index);
theModel.addElement(item);
updateUI();
}
} else if (evt.getSource() == theView.getEncounterCreatures()) {
try {
if (evt.getClickCount() == 2) {
int index = theView.getEncounterCreatures().locationToIndex(evt.getPoint());
ListModel dlm = theView.getEncounterCreatures().getModel();
Object item = dlm.getElementAt(index);
theView.getEncounterCreatures().ensureIndexIsVisible(index);
theModel.removeElement(item);
updateUI();
}
} catch (Exception e) {
//TODO: Should this really be ignored?
}
}
}
use of javax.swing.ListModel in project OpenAM by OpenRock.
the class CheckBoxJPanel method addTest.
public void addTest(CheckBoxListEntry entry) {
ListModel model = checkBoxjList.getModel();
if (model instanceof DefaultListModel) {
((DefaultListModel) model).addElement(entry);
} else {
DefaultListModel newModel = new DefaultListModel();
newModel.addElement(entry);
checkBoxjList.setModel(newModel);
}
}
use of javax.swing.ListModel in project adempiere by adempiere.
the class VTreeMaintenance method propertyChange.
// valueChanged
/**
* VTreePanel Changed
* @param e event
*/
public void propertyChange(PropertyChangeEvent e) {
MTreeNode tn = (MTreeNode) e.getNewValue();
log.info(tn.toString());
if (tn == null)
return;
ListModel model = centerList.getModel();
int size = model.getSize();
int index = -1;
for (index = 0; index < size; index++) {
ListItem item = (ListItem) model.getElementAt(index);
if (item.id == tn.getNode_ID())
break;
}
centerList.setSelectedIndex(index);
}
use of javax.swing.ListModel in project adempiere by adempiere.
the class VTreeMaintenance method action_treeAddAll.
// action_treeDelete
/**
* Action: Add All Nodes to Tree
*/
private void action_treeAddAll() {
log.info("");
ListModel model = centerList.getModel();
int size = model.getSize();
int index = -1;
for (index = 0; index < size; index++) {
ListItem item = (ListItem) model.getElementAt(index);
action_treeAdd(item);
}
}
Aggregations