Java Code Examples for javax.swing.DefaultListModel#setElementAt()
The following examples show how to use
javax.swing.DefaultListModel#setElementAt() .
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: LinkActionsEditorPanel.java From openAGV with Apache License 2.0 | 6 votes |
@Override protected void edit() { String value = getItemsList().getSelectedValue(); if (value == null) { return; } int index = getItemsList().getSelectedIndex(); JDialog parent = (JDialog) getTopLevelAncestor(); SelectionPanel content = new SelectionPanel( bundle.getString("linkActionsEditorPanel.dialog_actionSelectionEdit.title"), bundle.getString("linkActionsEditorPanel.dialog_actionSelection.label_action.text"), getPossibleItems(), value); StandardDetailsDialog dialog = new StandardDetailsDialog(parent, true, content); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); if (dialog.getReturnStatus() == StandardDetailsDialog.RET_OK) { DefaultListModel<String> model = (DefaultListModel<String>) getItemsList().getModel(); model.setElementAt(content.getValue().toString(), index); } }
Example 2
Source File: LocationTypeActionsEditorPanel.java From openAGV with Apache License 2.0 | 6 votes |
@Override protected void edit() { String value = getItemsList().getSelectedValue(); if (value == null) { return; } int index = getItemsList().getSelectedIndex(); JDialog parent = (JDialog) getTopLevelAncestor(); StringPanel content = new StringPanel( bundle.getString("locationTypeActionsEditorPanel.dialog_actionDefinitionEdit.title"), bundle.getString("locationTypeActionsEditorPanel.dialog_actionDefinition.label_action.text"), value); StandardDetailsDialog dialog = new StandardDetailsDialog(parent, true, content); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); if (dialog.getReturnStatus() == StandardDetailsDialog.RET_OK) { DefaultListModel<String> model = (DefaultListModel<String>) getItemsList().getModel(); model.setElementAt(content.getText(), index); } }
Example 3
Source File: ManageGroupsPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void propertyChange(PropertyChangeEvent event) { if(event.getPropertyName().equals("groupRename")) { String oldGroupName = (String)event.getOldValue(); String newGroupName = (String)event.getNewValue(); DefaultListModel model = (DefaultListModel) groupList.getModel(); for(int i = 0; i < model.getSize(); i++) { if(((String)model.getElementAt(i)).equals(oldGroupName)) { model.setElementAt(newGroupName, i); } } } }
Example 4
Source File: ClassPathFormImpl.java From beast-mcmc with GNU Lesser General Public License v2.1 | 5 votes |
public void actionPerformed(ActionEvent e) { String cp = getText(); if (Validator.isEmpty(cp)) { signalViolation(Messages.getString("specifyClassPath")); return; } DefaultListModel model = (DefaultListModel) _classpathList.getModel(); if (_classpathList.isSelectionEmpty()) { model.addElement(cp); clear(); } else { model.setElementAt(cp, _classpathList.getSelectedIndex()); } }
Example 5
Source File: ClassPathFormImpl.java From magarena with GNU General Public License v3.0 | 5 votes |
public void actionPerformed(ActionEvent e) { String cp = getText(); if (Validator.isEmpty(cp)) { signalViolation(Messages.getString("specifyClassPath")); return; } DefaultListModel model = (DefaultListModel) _classpathList.getModel(); if (_classpathList.isSelectionEmpty()) { model.addElement(cp); clear(); } else { model.setElementAt(cp, _classpathList.getSelectedIndex()); } }
Example 6
Source File: ClassPathFormImpl.java From PyramidShader with GNU General Public License v3.0 | 5 votes |
public void actionPerformed(ActionEvent e) { String cp = getText(); if (Validator.isEmpty(cp)) { signalViolation(Messages.getString("specifyClassPath")); return; } DefaultListModel model = (DefaultListModel) _classpathList.getModel(); if (_classpathList.isSelectionEmpty()) { model.addElement(cp); clear(); } else { model.setElementAt(cp, _classpathList.getSelectedIndex()); } }
Example 7
Source File: ClassPathFormImpl.java From jmkvpropedit with BSD 2-Clause "Simplified" License | 5 votes |
public void actionPerformed(ActionEvent e) { String cp = getText(); if (Validator.isEmpty(cp)) { signalViolation(Messages.getString("specifyClassPath")); return; } DefaultListModel model = (DefaultListModel) _classpathList.getModel(); if (_classpathList.isSelectionEmpty()) { model.addElement(cp); clear(); } else { model.setElementAt(cp, _classpathList.getSelectedIndex()); } }