Java Code Examples for javax.swing.JList#isSelectionEmpty()
The following examples show how to use
javax.swing.JList#isSelectionEmpty() .
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: UseSpecificCatchCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
private void removeSelected(JList list, String prefKey) { DefaultListModel m = (DefaultListModel)list.getModel(); while (!list.isSelectionEmpty()) { m.remove(list.getSelectionModel().getLeadSelectionIndex()); } updatePreference(list, prefKey); }
Example 2
Source File: ViewTooltips.java From netbeans with Apache License 2.0 | 5 votes |
/** Configures a list cell renderer and sets up sizing and the * backing image from it */ public boolean configure (Object nd, JScrollPane tv, JList list, int row) { boolean sameVn = setLastRendereredObject(nd); boolean sameComp = setLastRenderedScrollPane (tv); Component renderer = null; bg = list.getBackground(); boolean sel = list.isSelectionEmpty() ? false : list.getSelectionModel().isSelectedIndex(row); renderer = list.getCellRenderer().getListCellRendererComponent(list, nd, row, sel, false); if (renderer != null) { setComponent (renderer, list); } return true; }
Example 3
Source File: ConfigurableDialog.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
private Configurable getSelectedValue() { if (!localConfigList.isSelectionEmpty()) { return localConfigList.getSelectedValue(); } else { for (JList<Configurable> list : remoteConfigLists.values()) { if (!list.isSelectionEmpty()) { return list.getSelectedValue(); } } } return null; }
Example 4
Source File: DbxFileActions.java From Open-LaTeX-Studio with MIT License | 5 votes |
/** * Shows a .tex files list from user's dropbox and opens the selected one * * @return List, that contatins user's .tex files from his dropbox; can be * empty */ public void openFromDropbox(DropboxRevisionsTopComponent drtc, RevisionDisplayTopComponent revtc) { List<DbxEntryDto> dbxEntries = getDbxTexEntries(DbxUtil.getDbxClient()); if (!dbxEntries.isEmpty()) { JList<DbxEntryDto> list = new JList(dbxEntries.toArray()); list.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); int option = JOptionPane.showConfirmDialog(null, list, "Open file from Dropbox", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION && !list.isSelectionEmpty()) { DbxEntryDto entry = list.getSelectedValue(); String localPath = ApplicationUtils.getAppDirectory() + File.separator + entry.getName(); File outputFile = DbxUtil.downloadRemoteFile(entry, localPath); revtc.close(); drtc.updateRevisionsList(entry.getPath()); drtc.open(); drtc.requestActive(); String content = FileService.readFromFile(outputFile.getAbsolutePath()); etc.setEditorContent(content); etc.setCurrentFile(outputFile); etc.getEditorState().setDbxState(new DbxState(entry.getPath(), entry.getRevision())); etc.getEditorState().setModified(false); etc.getEditorState().setPreviewDisplayed(false); } } else{ JOptionPane.showMessageDialog(etc, "No .tex files found!", "Error", JOptionPane.ERROR_MESSAGE); } }
Example 5
Source File: UseSpecificCatchCustomizer.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void valueChanged(ListSelectionEvent lse) { JList lst = (JList)lse.getSource(); boolean sel = lst.isEnabled() && !lst.isSelectionEmpty(); btnRemoveGeneric.setEnabled(sel); }