List of usage examples for javax.swing JOptionPane YES_OPTION
int YES_OPTION
To view the source code for javax.swing JOptionPane YES_OPTION.
Click Source Link
From source file:contactsdirectory.frontend.MainJFrame.java
private void removePerson() { if (jListPerson.getSelectedIndex() < 0) { JOptionPane.showMessageDialog(this, localizedTexts.getString("noPersonSelected"), "", JOptionPane.INFORMATION_MESSAGE); return;/* www . j a v a 2s .co m*/ } if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(rootPane, localizedTexts.getString("deletePersonMsg"), "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) { try { Person person = getSelectedPerson(); jProgressBar.setIndeterminate(true); jProgressBar.setVisible(true); RemovePersonSwingWorker worker = new RemovePersonSwingWorker(person); worker.execute(); ((DefaultListModel<Contact>) jListPerson.getModel()).removeElement(person); jProgressBar.setVisible(false); jProgressBar.setIndeterminate(false); } catch (RuntimeException e) { JOptionPane.showMessageDialog(this, localizedTexts.getString("noPersonRemoved"), localizedTexts.getString("errorMsgTitle"), JOptionPane.ERROR_MESSAGE); } } }
From source file:com.jug.MoMA.java
/** * * @param guiFrame//from w w w. j a v a 2 s.com * parent frame * @param datapath * path to be suggested to open * @return */ private File showStartupDialog(final JFrame guiFrame, final String datapath) { File file = null; final String parentFolder = datapath.substring(0, datapath.lastIndexOf(File.separatorChar)); // DATA TO BE LOADED --- DATA TO BE LOADED --- DATA TO BE LOADED --- DATA TO BE LOADED int decision = 0; if (datapath.equals(System.getProperty("user.home"))) { decision = JOptionPane.NO_OPTION; } else { final String message = "Should the MotherMachine be opened with the data found in:\n" + datapath + "\n\nIn case you want to choose a folder please select 'No'..."; final String title = "MotherMachine Data Folder Selection"; decision = JOptionPane.showConfirmDialog(guiFrame, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); } if (decision == JOptionPane.YES_OPTION) { file = new File(datapath); } else { file = showFolderChooser(guiFrame, parentFolder); } // CLASSIFIER TO BE LOADED --- CLASSIFIER TO BE LOADED --- CLASSIFIER TO BE LOADED // final String message = "Should this classifier be used:\n" + SEGMENTATION_CLASSIFIER_MODEL_FILE + "\n\nIn case you want to choose a different one, please select 'No'..."; // final String title = "MotherMachine Classifier Selection"; // decision = JOptionPane.showConfirmDialog( guiFrame, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); // if ( decision == JOptionPane.YES_OPTION ) { // GrowthLineSegmentationMagic.setClassifier( SEGMENTATION_CLASSIFIER_MODEL_FILE, "" ); // } else { // final FileDialog fd = new FileDialog( guiFrame, "Select classifier model file...", FileDialog.LOAD ); // fd.setDirectory( SEGMENTATION_CLASSIFIER_MODEL_FILE ); // fd.setFilenameFilter( new FilenameFilter() { // // @Override // public boolean accept( final File dir, final String name ) { // final String lowercaseName = name.toLowerCase(); // if ( lowercaseName.endsWith( ".model" ) ) { // return true; // } else { // return false; // } // } // } ); // fd.setVisible( true ); // final String filename = fd.getDirectory() + "/" + fd.getFile(); // if ( filename != null ) { // SEGMENTATION_CLASSIFIER_MODEL_FILE = filename; // } // } return file; }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.MainForm.java
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing if (this.application == null) { if (JOptionPane.showConfirmDialog(this, "Do you really want to close the aplication?", "Confirmation", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { saveSettings();//ww w. jav a2 s . co m this.frameLayers.dispose(); this.frameToolOptions.dispose(); this.frameTools.dispose(); dispose(); Log.info("The MainForm disposed"); } else { Log.info("Closing rejected by user"); } } else { try { if (this.application.isReadyForDestroying(this)) { Log.info("Destroying application"); this.application.destroy(this); Log.info("Application has been destroyed"); dispose(); } } catch (Exception ex) { Log.error("Error during application close operation", ex); dispose(); } } }
From source file:au.com.jwatmuff.eventmanager.gui.main.LoadCompetitionWindow.java
private void saveBackupButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBackupButtonActionPerformed DatabaseInfo info = (DatabaseInfo) competitionList.getSelectedValue(); if (info == null || !info.local) return;// w w w .ja va2 s. co m JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileNameExtensionFilter("Event Manager Files", "evm")); if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.getName().toLowerCase().endsWith(".evm")) file = new File(file.getAbsolutePath() + ".evm"); if (file.exists()) { int result = JOptionPane.showConfirmDialog(rootPane, file.getName() + " already exists. Overwrite file?", "Save Backup", JOptionPane.YES_NO_OPTION); if (result != JOptionPane.YES_OPTION) return; } try { File tempDir = Files.createTempDirectory("event-manager").toFile(); FileUtils.copyDirectory(info.localDirectory, tempDir); File lockFile = new File(tempDir, "update.dat.lock"); lockFile.delete(); /* change id */ Properties props = new Properties(); FileReader fr = new FileReader(new File(tempDir, "info.dat")); props.load(fr); fr.close(); props.setProperty("old-UUID", props.getProperty("UUID", "none")); props.setProperty("UUID", UUID.randomUUID().toString()); FileWriter fw = new FileWriter(new File(tempDir, "info.dat")); props.store(fw, ""); fw.close(); ZipUtils.zipFolder(tempDir, file, false); } catch (Exception e) { GUIUtils.displayError(this, "Failed to save file: " + e.getMessage()); } } }
From source file:com.g2inc.scap.editor.gui.windows.EditorMainWindow.java
@Override public void windowClosing(WindowEvent arg0) { // save window location and bounds Point myLocation = getLocation(); Dimension mySize = getSize(); guiProps.setProperty(EditorConfiguration.PROPERTY_MAIN_WINDOW_LOCATION_X, myLocation.x + ""); guiProps.setProperty(EditorConfiguration.PROPERTY_MAIN_WINDOW_LOCATION_Y, myLocation.y + ""); guiProps.setProperty(EditorConfiguration.PROPERTY_MAIN_WINDOW_SIZE_X, mySize.width + ""); guiProps.setProperty(EditorConfiguration.PROPERTY_MAIN_WINDOW_SIZE_Y, mySize.height + ""); guiProps.save();// w w w . j a va 2 s. c o m // cycle through open internal frames(documents) // and see if any of them need to be saved JInternalFrame[] openFrames = desktopPane.getAllFrames(); if (openFrames != null && openFrames.length > 0) { for (int x = 0; x < openFrames.length; x++) { JInternalFrame internalWin = openFrames[x]; if (internalWin instanceof EditorForm) { EditorForm ef = (EditorForm) internalWin; if (ef.getDocument() == null) { continue; } String filename = ef.getDocument().getFilename(); if (filename == null) { continue; } if (ef.isDirty()) { Object[] options = { EditorMessages.FILE_CHOOSER_BUTTON_TEXT_SAVE, "Discard" }; String message = filename + " has unsaved changes. Do you want to save or discard changes?"; String dTitle = "Unsaved changes"; int n = JOptionPane.showOptionDialog(this, message, dTitle, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (n == JOptionPane.DEFAULT_OPTION || n == JOptionPane.YES_OPTION) { final GenericProgressDialog progress = new GenericProgressDialog( EditorMainWindow.getInstance(), true); progress.setMessage("Saving changes to " + ef.getDocument().getFilename()); try { final SCAPDocument sdoc = (SCAPDocument) ef.getDocument(); Runnable r = new Runnable() { @Override public void run() { try { sdoc.save(); } catch (Exception e) { progress.setException(e); } } }; progress.setRunnable(r); progress.pack(); progress.setLocationRelativeTo(this); progress.setVisible(true); if (progress.getException() != null) { throw (progress.getException()); } ef.setDirty(false); } catch (Exception e) { LOG.error("Error saving file " + filename, e); String errMessage = filename + " couldn't be saved. An error occured: " + e.getMessage(); dTitle = "File save error"; EditorUtil.showMessageDialog(this, errMessage, dTitle, JOptionPane.ERROR_MESSAGE); } } } } } } }
From source file:edu.ku.brc.specify.tasks.SystemSetupTask.java
/** * Launches dialog for Importing and Exporting Forms and Resources. */// w w w .j a va2s . c o m public static boolean askBeforeStartingTool() { if (SubPaneMgr.getInstance().aboutToShutdown()) { Object[] options = { getResourceString("CONTINUE"), //$NON-NLS-1$ getResourceString("CANCEL") //$NON-NLS-1$ }; return JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(getTopWindow(), getLocalizedMessage(getI18NKey("REI_MSG")), //$NON-NLS-1$ getResourceString(getI18NKey("REI_TITLE")), //$NON-NLS-1$ JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); } return false; }
From source file:de.tor.tribes.ui.panels.MinimapPanel.java
private void fireSaveScreenshotEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fireSaveScreenshotEvent String dir = GlobalOptions.getProperty("screen.dir"); JFileChooser chooser = null;/*from w w w.java 2 s. co m*/ try { chooser = new JFileChooser(dir); } catch (Exception e) { JOptionPaneHelper.showErrorBox(this, "Konnte Dateiauswahldialog nicht ffnen.\nMglicherweise verwendest du Windows Vista. Ist dies der Fall, beende DS Workbench, klicke mit der rechten Maustaste auf DSWorkbench.exe,\n" + "whle 'Eigenschaften' und deaktiviere dort unter 'Kompatibilitt' den Windows XP Kompatibilittsmodus.", "Fehler"); return; } chooser.setDialogTitle("Speichern unter..."); chooser.setSelectedFile(new File("map")); final String type = (String) jFileTypeChooser.getSelectedItem(); chooser.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { return (f != null) && (f.isDirectory() || f.getName().endsWith(type)); } @Override public String getDescription() { return "*." + type; } }); int ret = chooser.showSaveDialog(jScreenshotControl); if (ret == JFileChooser.APPROVE_OPTION) { try { File f = chooser.getSelectedFile(); String file = f.getCanonicalPath(); if (!file.endsWith(type)) { file += "." + type; } File target = new File(file); if (target.exists()) { //ask if overwrite if (JOptionPaneHelper.showQuestionConfirmBox(jScreenshotControl, "Existierende Datei berschreiben?", "berschreiben", "Nein", "Ja") != JOptionPane.YES_OPTION) { return; } } ImageIO.write(mScreenshotPanel.getResult(jTransparancySlider.getValue()), type, target); GlobalOptions.addProperty("screen.dir", target.getParent()); } catch (Exception e) { logger.error("Failed to write map shot", e); } } }
From source file:de.juwimm.cms.util.Communication.java
@SuppressWarnings("unchecked") public boolean removeViewComponent(int intViewComponentId, String viewComponentName, byte onlineState) { boolean retVal = false; try {/*from w w w .j a v a 2s. co m*/ // CHECK IF THIS NODE CONTAINS SUBNODES ViewIdAndInfoTextValue[] str = getAllChildrenNamesWithUnit(intViewComponentId); String units = ""; if (str != null && str.length > 0) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < str.length; i++) { sb.append(str[i].getInfoText().trim()).append("\n"); } units = sb.toString(); } if (!units.equalsIgnoreCase("")) { if (!isUserInRole(UserRights.SITE_ROOT)) { // dazwischen, damit sparen wir uns das zweite... String msg = Messages.getString("comm.removevc.containsunitsandcannotremove", units); JOptionPane.showMessageDialog(UIConstants.getMainFrame(), msg, rb.getString("dialog.title"), JOptionPane.ERROR_MESSAGE); return false; } units = Messages.getString("comm.removevc.header_units", units); } String refVcs = ""; ViewComponentValue[] refDao = getViewComponentsWithReferenceToViewComponentId(intViewComponentId); if (refDao != null && refDao.length > 0) { StringBuffer sb = new StringBuffer(); for (int j = 0; j < refDao.length; j++) { if (refDao[j].getViewType() == Constants.VIEW_TYPE_INTERNAL_LINK) { // InternalLink in the Tree sb.append(Messages.getString("comm.removevc.refvc.internallink", ("\"" + refDao[j].getDisplayLinkName() + "\""), ("\"" + refDao[j].getMetaData().trim() + "\""))).append("\n"); } else if (refDao[j].getViewType() == Constants.VIEW_TYPE_SYMLINK) { // reference though Symlink in the Tree sb.append(Messages.getString("comm.removevc.refvc.symlink", ("\"" + refDao[j].getDisplayLinkName() + "\""), ("\"" + refDao[j].getMetaData().trim() + "\""))).append("\n"); } else { // reference through links in the content sb.append(Messages.getString("comm.removevc.refvc.content", ("\"" + refDao[j].getDisplayLinkName() + "\""), ("\"" + refDao[j].getMetaData().trim() + "\""))).append("\n"); } } refVcs = sb.toString(); } if (!refVcs.equals("")) { refVcs = Messages.getString("comm.removevc.header_refvcs", refVcs); } String teaserText = ""; boolean teaserReferenced = false; try { StringBuilder refTeaser = new StringBuilder(""); XmlSearchValue[] xmlSearchValues = this.searchXml(getSiteId(), "//teaserRef"); if (xmlSearchValues != null && xmlSearchValues.length > 0) { // herausfinden, ob es sich um DIESEN Teaser handelt String resultRootStartElement = "<searchTeaserResult>"; String resultRootEndElement = "</searchTeaserResult>"; for (int i = 0; i < xmlSearchValues.length; i++) { StringBuilder stringBuilder = new StringBuilder(xmlSearchValues[i].getContent()); stringBuilder.insert(0, resultRootStartElement); stringBuilder.append(resultRootEndElement); Document doc = XercesHelper.string2Dom(stringBuilder.toString()); Iterator<Element> teaserIterator = XercesHelper.findNodes(doc, "searchTeaserResult/teaserRef"); while (teaserIterator.hasNext()) { Element element = teaserIterator.next(); String viewComponentIdValue = element.getAttribute("viewComponentId"); if (viewComponentIdValue != null && viewComponentIdValue.trim().length() > 0) { if (intViewComponentId == (new Integer(viewComponentIdValue)).intValue()) { teaserReferenced = true; refTeaser.append(this.getPathForViewComponentId( xmlSearchValues[i].getViewComponentId().intValue()) + "\n"); } } } } if (teaserReferenced) { teaserText = Messages.getString("comm.removevc.header.teaser", refTeaser.toString()); } } } catch (Exception exception) { log.error(exception.getMessage(), exception); } String msgHeader = ""; if (onlineState == Constants.ONLINE_STATUS_UNDEF || onlineState == Constants.ONLINE_STATUS_OFFLINE) { msgHeader = rb.getString("comm.removevc.header_offline"); } else { msgHeader = rb.getString("comm.removevc.header_online"); } String msgstr = msgHeader + units + refVcs + teaserText; int i = JOptionPane.showConfirmDialog(UIConstants.getMainFrame(), msgstr, rb.getString("dialog.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (i == JOptionPane.YES_OPTION) { if (onlineState == Constants.ONLINE_STATUS_UNDEF || onlineState == Constants.ONLINE_STATUS_OFFLINE) { getClientService().removeViewComponent(Integer.valueOf(intViewComponentId), true); /* * } else { // nothing at the moment, the code for here is * currently in PanTree actionViewComponentPerformed */ } retVal = true; } } catch (Exception exe) { log.error("Error removing vc", exe); } if (retVal) { try { checkOutPages.remove(new Integer(getViewComponent(intViewComponentId).getReference())); } catch (Exception exe) { } UIConstants.setStatusInfo(rb.getString("comm.removevc.statusinfo")); } return retVal; }
From source file:net.pms.newgui.NavigationShareTab.java
private PanelBuilder initSharedFoldersGuiComponents(CellConstraints cc) { // Apply the orientation for the locale ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale()); String colSpec = FormLayoutUtil.getColSpec(SHARED_FOLDER_COL_SPEC, orientation); FormLayout layoutFolders = new FormLayout(colSpec, SHARED_FOLDER_ROW_SPEC); PanelBuilder builderFolder = new PanelBuilder(layoutFolders); builderFolder.opaque(true);/* ww w . ja v a 2 s . co m*/ JComponent cmp = builderFolder.addSeparator(Messages.getString("FoldTab.7"), FormLayoutUtil.flip(cc.xyw(1, 1, 7), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); folderTableModel = new SharedFoldersTableModel(); sharedFolders = new JTable(folderTableModel); JPopupMenu popupMenu = new JPopupMenu(); JMenuItem menuItemMarkPlayed = new JMenuItem(Messages.getString("FoldTab.75")); JMenuItem menuItemMarkUnplayed = new JMenuItem(Messages.getString("FoldTab.76")); menuItemMarkPlayed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String path = (String) sharedFolders.getValueAt(sharedFolders.getSelectedRow(), 0); TableFilesStatus.setDirectoryFullyPlayed(path, true); } }); menuItemMarkUnplayed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String path = (String) sharedFolders.getValueAt(sharedFolders.getSelectedRow(), 0); TableFilesStatus.setDirectoryFullyPlayed(path, false); } }); popupMenu.add(menuItemMarkPlayed); popupMenu.add(menuItemMarkUnplayed); sharedFolders.setComponentPopupMenu(popupMenu); /* An attempt to set the correct row height adjusted for font scaling. * It sets all rows based on the font size of cell (0, 0). The + 4 is * to allow 2 pixels above and below the text. */ DefaultTableCellRenderer cellRenderer = (DefaultTableCellRenderer) sharedFolders.getCellRenderer(0, 0); FontMetrics metrics = cellRenderer.getFontMetrics(cellRenderer.getFont()); sharedFolders.setRowHeight(metrics.getLeading() + metrics.getMaxAscent() + metrics.getMaxDescent() + 4); sharedFolders.setIntercellSpacing(new Dimension(8, 2)); final JPanel tmpsharedPanel = sharedPanel; addButton.setToolTipText(Messages.getString("FoldTab.9")); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser; try { chooser = new JFileChooser(); } catch (Exception ee) { chooser = new JFileChooser(new RestrictedFileSystemView()); } chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog((Component) e.getSource()); if (returnVal == JFileChooser.APPROVE_OPTION) { int firstSelectedRow = sharedFolders.getSelectedRow(); if (firstSelectedRow >= 0) { ((SharedFoldersTableModel) sharedFolders.getModel()).insertRow(firstSelectedRow, new Object[] { chooser.getSelectedFile().getAbsolutePath(), true }); } else { ((SharedFoldersTableModel) sharedFolders.getModel()) .addRow(new Object[] { chooser.getSelectedFile().getAbsolutePath(), true }); } } } }); builderFolder.add(addButton, FormLayoutUtil.flip(cc.xy(2, 3), colSpec, orientation)); removeButton.setToolTipText(Messages.getString("FoldTab.36")); removeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int[] rows = sharedFolders.getSelectedRows(); if (rows.length > 0) { if (rows.length > 1) { if (JOptionPane.showConfirmDialog(tmpsharedPanel, String.format(Messages.getString("SharedFolders.ConfirmRemove"), rows.length), Messages.getString("Dialog.Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION) { return; } } for (int i = rows.length - 1; i >= 0; i--) { PMS.get().getDatabase().removeMediaEntriesInFolder( (String) sharedFolders.getValueAt(sharedFolders.getSelectedRow(), 0)); ((SharedFoldersTableModel) sharedFolders.getModel()).removeRow(rows[i]); } } } }); builderFolder.add(removeButton, FormLayoutUtil.flip(cc.xy(3, 3), colSpec, orientation)); arrowDownButton.setToolTipText(Messages.getString("SharedFolders.ArrowDown")); arrowDownButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < sharedFolders.getRowCount() - 1; i++) { if (sharedFolders.isRowSelected(i)) { Object value1 = sharedFolders.getValueAt(i, 0); boolean value2 = (boolean) sharedFolders.getValueAt(i, 1); sharedFolders.setValueAt(sharedFolders.getValueAt(i + 1, 0), i, 0); sharedFolders.setValueAt(value1, i + 1, 0); sharedFolders.setValueAt(sharedFolders.getValueAt(i + 1, 1), i, 1); sharedFolders.setValueAt(value2, i + 1, 1); sharedFolders.changeSelection(i + 1, 1, false, false); break; } } } }); builderFolder.add(arrowDownButton, FormLayoutUtil.flip(cc.xy(4, 3), colSpec, orientation)); arrowUpButton.setToolTipText(Messages.getString("SharedFolders.ArrowUp")); arrowUpButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 1; i < sharedFolders.getRowCount(); i++) { if (sharedFolders.isRowSelected(i)) { Object value1 = sharedFolders.getValueAt(i, 0); boolean value2 = (boolean) sharedFolders.getValueAt(i, 1); sharedFolders.setValueAt(sharedFolders.getValueAt(i - 1, 0), i, 0); sharedFolders.setValueAt(value1, i - 1, 0); sharedFolders.setValueAt(sharedFolders.getValueAt(i - 1, 1), i, 1); sharedFolders.setValueAt(value2, i - 1, 1); sharedFolders.changeSelection(i - 1, 1, false, false); break; } } } }); builderFolder.add(arrowUpButton, FormLayoutUtil.flip(cc.xy(5, 3), colSpec, orientation)); scanButton.setToolTipText(Messages.getString("FoldTab.2")); scanBusyIcon.start(); scanBusyDisabledIcon.start(); scanButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (configuration.getUseCache()) { DLNAMediaDatabase database = PMS.get().getDatabase(); if (database != null) { if (database.isScanLibraryRunning()) { int option = JOptionPane.showConfirmDialog(looksFrame, Messages.getString("FoldTab.10"), Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { database.stopScanLibrary(); looksFrame.setStatusLine(Messages.getString("FoldTab.41")); scanButton.setEnabled(false); scanButton.setToolTipText(Messages.getString("FoldTab.41")); } } else { database.scanLibrary(); scanButton.setIcon(scanBusyIcon); scanButton.setRolloverIcon(scanBusyRolloverIcon); scanButton.setPressedIcon(scanBusyPressedIcon); scanButton.setDisabledIcon(scanBusyDisabledIcon); scanButton.setToolTipText(Messages.getString("FoldTab.40")); } } } } }); /* * Hide the scan button in basic mode since it's better to let it be done in * realtime. */ if (!configuration.isHideAdvancedOptions()) { builderFolder.add(scanButton, FormLayoutUtil.flip(cc.xy(6, 3), colSpec, orientation)); } scanButton.setEnabled(configuration.getUseCache()); isScanSharedFoldersOnStartup = new JCheckBox(Messages.getString("NetworkTab.StartupScan"), configuration.isScanSharedFoldersOnStartup()); isScanSharedFoldersOnStartup.setToolTipText(Messages.getString("NetworkTab.StartupScanTooltip")); isScanSharedFoldersOnStartup.setContentAreaFilled(false); isScanSharedFoldersOnStartup.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setScanSharedFoldersOnStartup((e.getStateChange() == ItemEvent.SELECTED)); } }); builderFolder.add(isScanSharedFoldersOnStartup, FormLayoutUtil.flip(cc.xy(7, 3), colSpec, orientation)); updateSharedFolders(); JScrollPane pane = new JScrollPane(sharedFolders); Dimension d = sharedFolders.getPreferredSize(); pane.setPreferredSize(new Dimension(d.width, sharedFolders.getRowHeight() * 2)); builderFolder.add(pane, FormLayoutUtil.flip(cc.xyw(1, 5, 7, CellConstraints.DEFAULT, CellConstraints.FILL), colSpec, orientation)); return builderFolder; }