javax.swing.DefaultListModel Java Examples
The following examples show how to use
javax.swing.DefaultListModel.
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: MultipleRoiComputePanel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private void resetMaskListState() { maskNameListModel = new DefaultListModel<>(); final String[] currentSelectedMaskNames = getSelectedMaskNames(); if (product != null && raster != null) { //todo [multisize_products] compare scenerastertransform (or its successor) rather than size (tf) final ProductNodeGroup<Mask> maskGroup = product.getMaskGroup(); for (int i = 0; i < maskGroup.getNodeCount(); i++) { final Mask mask = maskGroup.get(i); if (mask.getRasterSize().equals(raster.getRasterSize())) { maskNameListModel.addElement(mask.getName()); } } maskNameList.setModel(maskNameListModel); } final String[] allNames = StringUtils.toStringArray(maskNameListModel.toArray()); indexesInMaskNameList = new int[allNames.length]; for (int i = 0; i < allNames.length; i++) { String name = allNames[i]; if (StringUtils.contains(currentSelectedMaskNames, name)) { maskNameList.getCheckBoxListSelectionModel().addSelectionInterval(i, i); } indexesInMaskNameList[i] = i; } updateEnablement(); }
Example #2
Source File: RadVizPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
@Override public void setDataTable(DataTable dataTable) { super.setDataTable(dataTable); this.dataTable = dataTable; // ignore list DefaultListModel<String> ignoreModel = (DefaultListModel<String>) ignoreList.getModel(); ignoreModel.clear(); for (int i = 0; i < this.dataTable.getNumberOfColumns(); i++) { if (i == colorColumn) { continue; } ignoreModel.addElement(this.dataTable.getColumnName(i)); } this.maxWeight = getMaxWeight(dataTable); repaint(); }
Example #3
Source File: StatePane.java From attic-polygene-java with Apache License 2.0 | 6 votes |
StatePane( DetailModelPane detailModelPane ) { super( detailModelPane ); this.setLayout( new BorderLayout() ); this.add( contentPane, BorderLayout.CENTER ); methodListModel = new DefaultListModel(); methodList.setModel( methodListModel ); methodList.setCellRenderer( new MethodListCellRenderer() ); methodList.setPrototypeCellValue( "12345678901234567890" ); methodList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); methodDetailTableModel = new MethodDetailTableModel(); methodDetailTable.setModel( methodDetailTableModel ); TableColumnModel columnModel = methodDetailTable.getColumnModel(); columnModel.getColumn( 0 ).setPreferredWidth( 75 ); columnModel.getColumn( 1 ).setPreferredWidth( 400 ); //splitPane.setDividerLocation( .1 ); methodList.addListSelectionListener( this::methodListValueChanged ); }
Example #4
Source File: FrmLayerProperty.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
private void checkBoxList_FieldsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_checkBoxList_FieldsMouseClicked // TODO add your handling code here: DefaultListModel listModel = (DefaultListModel) this.checkBoxList_Fields.getModel(); int idx = this.checkBoxList_Fields.getSelectedIndex(); CheckBoxListEntry item = (CheckBoxListEntry) listModel.getElementAt(idx); String selFieldStr = item.getValue().toString(); if (item.isSelected()) { PolygonBreak aPB = new PolygonBreak(); aPB.setCaption(selFieldStr); aPB.setTag(selFieldStr); aPB.setColor(LegendManage.createRandomColors(1)[0]); legendView_Chart.getLegendScheme().getLegendBreaks().add(aPB); } else { for (int i = 0; i < legendView_Chart.getLegendScheme().getBreakNum(); i++) { if (legendView_Chart.getLegendScheme().getLegendBreaks().get(i).getTag().equals(selFieldStr)) { legendView_Chart.getLegendScheme().getLegendBreaks().remove(i); break; } } } this.legendView_Chart.repaint(); }
Example #5
Source File: CustomizerCompile.java From netbeans with Apache License 2.0 | 6 votes |
private void addProcessorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addProcessorButtonActionPerformed final AddAnnotationProcessor panel = new AddAnnotationProcessor(); final DialogDescriptor desc = new DialogDescriptor(panel, NbBundle.getMessage(CustomizerCompile.class, "LBL_AddAnnotationProcessor_Title")); //NOI18N desc.setValid(false); panel.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { String fqn = panel.getProcessorFQN(); desc.setValid(fqn.length() > 0); } }); Dialog dlg = DialogDisplayer.getDefault().createDialog(desc); dlg.setVisible(true); if (desc.getValue() == DialogDescriptor.OK_OPTION) { ((DefaultListModel)annotationProcessorsList.getModel()).addElement(panel.getProcessorFQN()); } dlg.dispose(); }
Example #6
Source File: StartUp.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 6 votes |
private void loadRecent() { recentModel = new DefaultListModel(); for (RecentItem recentItem : sMainFrame.getRecentItems().getRECENT_ITEMS()) { recentModel.addElement(recentItem); } recentItems.setModel(recentModel); if (recentModel.isEmpty()) { recentToggle.setEnabled(false); recentToggle.setForeground(Color.GRAY); appToggle.setSelected(true); } else { recentItems.setSelectedIndex(0); recentToggle.setSelected(true); } }
Example #7
Source File: FrmAppsManager.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
private void checkBoxList_PluginMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_checkBoxList_PluginMouseClicked // TODO add your handling code here: DefaultListModel listModel = (DefaultListModel) this.checkBoxList_Plugin.getModel(); int idx = this.checkBoxList_Plugin.getSelectedIndex(); CheckBoxListEntry item = (CheckBoxListEntry) listModel.getElementAt(idx); Application plugin = (Application) item.getValue(); if (item.isSelected()) { parent.loadApplication(plugin); parent.validate(); } else { parent.unloadApplication(plugin); parent.validate(); } String detailStr = "Name: " + plugin.getName() + System.getProperty("line.separator") + "Author: " + plugin.getAuthor() + System.getProperty("line.separator") + "Version: " + plugin.getVersion() + System.getProperty("line.separator") + "Description: " + plugin.getDescription() + System.getProperty("line.separator") + "Jar Path: " + plugin.getJarPath() + System.getProperty("line.separator") + "Class Name: " + plugin.getClassName(); this.jTextArea_PluginDetails.setText(detailStr); }
Example #8
Source File: ScrWordClasses.java From PolyGlot with MIT License | 6 votes |
private void deleteWordProperty() { WordClass prop = lstProperties.getSelectedValue(); int position = lstProperties.getSelectedIndex(); if (prop == null || InfoBox.yesNoCancel("Are you sure?", "This will delete the class from all words." + " Values will be irretrievably lost.", core.getRootWindow()) != JOptionPane.YES_OPTION) { return; } try { core.getWordClassCollection().deleteNodeById(prop.getId()); } catch (Exception e) { IOHandler.writeErrorLog(e); InfoBox.error("Unable to Delete", "Unable to delete property: " + e.getLocalizedMessage(), core.getRootWindow()); } DefaultListModel listModel = (DefaultListModel) lstProperties.getModel(); listModel.removeElement(prop); if (position == 0) { lstProperties.setSelectedIndex(position); } else { lstProperties.setSelectedIndex(position - 1); } }
Example #9
Source File: ClassPathUiSupport.java From netbeans with Apache License 2.0 | 6 votes |
/** Moves items up in the list. The indices array will contain * indices to be selected after the change was done. */ public static int[] moveUp( DefaultListModel listModel, int indices[]) { if( indices == null || indices.length == 0 ) { assert false : "MoveUp button should be disabled"; // NOI18N } // Move the items up for( int i = 0; i < indices.length; i++ ) { Object item = listModel.get( indices[i] ); listModel.remove( indices[i] ); listModel.add( indices[i] - 1, item ); // Keep the selection a before indices[i] -= 1; } return indices; }
Example #10
Source File: MultiFileSelectorPanel.java From opensim-gui with Apache License 2.0 | 6 votes |
/** Creates new form MultiFileSelectorPanel */ public MultiFileSelectorPanel(Vector<String> initialFileNames, FileFilter fileFilter) { this.listModel = new DefaultListModel(); this.fileNames = initialFileNames; initComponents(); fileName.setFileFilter(fileFilter); fileList.setModel(listModel); for (String fileName1 : fileNames) { listModel.addElement(fileName1); } fileList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if(event.getValueIsAdjusting()) return; listSelectionChanged(); } }); updatePanel(); }
Example #11
Source File: FrmMeteoData.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
private void initialize() { this.setTitle("Meteo Data"); this.jList_DataFiles.setModel(new DefaultListModel()); this.jComboBox_Variable.removeAllItems(); this.jComboBox_Time.removeAllItems(); this.jComboBox_Level.removeAllItems(); this.jComboBox_DrawType.removeAllItems(); //Control enable set for (Component aItem : this.jToolBar1.getComponents()) { aItem.setEnabled(false); } //this.jButton_OpenData.setEnabled(true); this.jSplitButton_OpenData.setEnabled(true); this.jPanel_DataSet.setEnabled(false); this.jCheckBox_ColorVar.setVisible(false); this.jCheckBox_Big_Endian.setVisible(false); }
Example #12
Source File: ProjectInstallerEditPanel.java From jclic with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent ev) { if (ev != null && ev.getSource() != null) { DefaultListModel<Object> src = null, dest = null; JList list = null; if (ev.getSource() == addBtn) { src = availModel; dest = filesModel; list = availFiles; } else if (ev.getSource() == removeBtn) { dest = availModel; src = filesModel; list = includedFiles; } if (dest != null && src != null & list != null) { Object[] values = list.getSelectedValuesList().toArray(); if (values != null) { for (int i = 0; i < values.length; i++) { src.removeElement(values[i]); dest.addElement(values[i]); } } checkButtons(); } } }
Example #13
Source File: DragOrderedJList.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
@Override public void setListData(final Vector<?> listData) { final DefaultListModel<Object> model = new DefaultListModel<Object>(); for (final Object element : listData) { model.addElement(element); } setModel(model); }
Example #14
Source File: ClipboardImportPanel.java From netbeans with Apache License 2.0 | 5 votes |
private ListModel createImportListModel() { DefaultListModel m = new DefaultListModel(); for (String fqn : fqns) { m.addElement(fqn); } return m; }
Example #15
Source File: CheckListBox.java From nextreports-designer with Apache License 2.0 | 5 votes |
public void setSelected(boolean b) { DefaultListModel model = (DefaultListModel) this.getModel(); int size = model.size(); for (int i = 0; i < size; i++) { CheckListItem item = (CheckListItem) model.getElementAt(i); item.setSelected(b); } repaint(); }
Example #16
Source File: MainWindow.java From ripme with MIT License | 5 votes |
private void updateQueue(DefaultListModel<Object> model) { if (model == null) model = queueListModel; if (model.size() > 0) { Utils.setConfigList("queue", (Enumeration<Object>) model.elements()); Utils.saveConfig(); } MainWindow.optionQueue.setText(String.format("%s%s", Utils.getLocalizedString("queue"), model.size() == 0 ? "" : "(" + model.size() + ")")); }
Example #17
Source File: EditCustomCategoryDialog.java From tda with GNU Lesser General Public License v2.1 | 5 votes |
private void addToList(CustomCategory cat) { DefaultListModel dlm = ((DefaultListModel) catList.getModel()); dlm.ensureCapacity(dlm.getSize() +1); dlm.addElement(cat); catList.ensureIndexIsVisible(dlm.getSize()); }
Example #18
Source File: EnchantmentsRegistry.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { enchantmentsScrollPane = new javax.swing.JScrollPane(); enchantmentsList = new javax.swing.JList(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("Enchantments"); enchantmentsList.setFont(new java.awt.Font("Lucida Console", Font.PLAIN, 11)); // NOI18N enchantmentsList.setModel(new javax.swing.DefaultListModel()); enchantmentsScrollPane.setViewportView(enchantmentsList); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(enchantmentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 980, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(enchantmentsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE) .addContainerGap()) ); pack(); }
Example #19
Source File: ProjectListManager.java From tmc-intellij with MIT License | 5 votes |
private void addExercisesToListModel(DefaultListModel listModel, List<Exercise> exercises) { logger.info("Processing addExercisesToListModel. @ProjectListManager"); for (Exercise ex : exercises) { listModel.addElement(ex); } }
Example #20
Source File: PhpProjectProperties.java From netbeans with Apache License 2.0 | 5 votes |
public DefaultListModel<BasePathSupport.Item> getPrivateIncludePathListModel() { if (privateIncludePathListModel == null) { EditableProperties properties = project.getHelper().getProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH); privateIncludePathListModel = PathUiSupport.createListModel(includePathSupport.itemsIterator( properties.getProperty(PRIVATE_INCLUDE_PATH))); } return privateIncludePathListModel; }
Example #21
Source File: PathsCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
private static DefaultTreeModel toTreeModel(final DefaultListModel lm, final String rootName) { DefaultMutableTreeNode root = new DefaultMutableTreeNode(rootName); for (int i = 0; i < lm.getSize(); i++) { Object obj = lm.getElementAt(i); if (obj instanceof ClassPathSupport.Item) { root.add(toTreeNode(obj)); } } return new DefaultTreeModel(root); }
Example #22
Source File: AdressList.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
public AdressList(MyCodeList cl) { super(new DefaultListModel<String>()); this.cl = cl; cl.setAdressList(this); this.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 13)); this.updateAdr(); this.setSelectionModel(new DefaultListSelectionModel() { @Override public void setSelectionInterval(int index0, int index1) { super.setSelectionInterval(-1, -1); } }); this.setPrototypeCellValue("0000"); SwingUtils.disableSelection(this); }
Example #23
Source File: DownloadMapsWindow.java From triplea with GNU General Public License v3.0 | 5 votes |
private JButton buildMapActionButton( final MapAction action, final JList<String> gamesList, final List<DownloadFileDescription> maps, final DefaultListModel<String> listModel) { final JButton actionButton; if (action == MapAction.REMOVE) { actionButton = new JButtonBuilder() .title("Remove") .toolTip( "Click this button to remove the maps selected above from your computer. " + MULTIPLE_SELECT_MSG) .actionListener(removeAction(gamesList, maps, listModel)) .build(); } else { actionButton = new JButtonBuilder() .title((action == MapAction.INSTALL) ? "Install" : "Update") .toolTip( "Click this button to download and install the maps selected above. " + MULTIPLE_SELECT_MSG) .actionListener(installAction(gamesList, maps, listModel)) .build(); } return actionButton; }
Example #24
Source File: SearchPanel.java From netbeans with Apache License 2.0 | 5 votes |
/** * Returns the {@code ListModel} for the given libraries. * * @param libraries libraries for which to return the model. * @return {@code ListModel} for the given libraries. */ private ListModel<Library> libraryListModelFor(Library[] libraries) { DefaultListModel<Library> listModel = new DefaultListModel<>(); if (libraries != null) { for (Library library : libraries) { listModel.addElement(library); } } return listModel; }
Example #25
Source File: MethodCandidateChooser.java From netbeans with Apache License 2.0 | 5 votes |
private ListModel createListModel() { DefaultListModel dlm = new DefaultListModel(); for (Candidate cand: toShow) { dlm.addElement(cand); } return dlm; }
Example #26
Source File: ArrayEditorDialog.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
private void moveUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUpActionPerformed int[] indices = arrayList.getSelectedIndices(); for(int i : indices) { Object o = ((DefaultListModel)arrayList.getModel()).elementAt(i); ((DefaultListModel)arrayList.getModel()).remove(i); ((DefaultListModel)arrayList.getModel()).insertElementAt(o, i - 1); } arrayList.setSelectionInterval(indices[0] - 1, indices[indices.length - 1] - 1); }
Example #27
Source File: ManageGroupsPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void removeGroups(Iterable<Group> groups) { DefaultListModel model = (DefaultListModel) groupList.getModel(); for (final Group groupIter : groups) { if(groupIter != null) { model.removeElement(groupIter.getName()); RP.post(new Runnable() { @Override public void run() { groupIter.destroy(); } }); } } }
Example #28
Source File: SpellcheckerOptionsPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void updateUsedIn() { List<String> categories = loadCategories(); DefaultListModel model = new DefaultListModel(); for (String category : categories) { model.addElement(category); } lUseIn.setModel(model); }
Example #29
Source File: FrmJoinNCFiles.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
private void jButton_SelectAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_SelectAllActionPerformed // TODO add your handling code here: DefaultListModel listModel_all = (DefaultListModel)this.jList_AllFiles.getModel(); DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel(); listModel_sel.clear(); for (int i = 0; i < listModel_all.getSize(); i++){ listModel_sel.addElement(listModel_all.getElementAt(i)); } }
Example #30
Source File: FrmJoinNCFiles.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
private void jButton_UnSelecteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_UnSelecteActionPerformed // TODO add your handling code here: DefaultListModel listModel_sel = (DefaultListModel)this.jList_SelectedFiles.getModel(); List<String> selNames = this.jList_SelectedFiles.getSelectedValuesList(); for (String name : selNames){ listModel_sel.removeElement(name); } }