List of usage examples for javax.swing JOptionPane YES_NO_OPTION
int YES_NO_OPTION
To view the source code for javax.swing JOptionPane YES_NO_OPTION.
Click Source Link
showConfirmDialog
. From source file:com.opendoorlogistics.studio.scripts.list.ScriptsPanel.java
private List<MyAction> createActions(AppPermissions appPermissions) { ArrayList<MyAction> ret = new ArrayList<>(); if (appPermissions.isScriptEditingAllowed()) { ret.add(new MyAction(SimpleActionConfig.addItem.setItemName("script"), false, false, false) { @Override//from ww w .ja va 2 s. c o m public void actionPerformed(ActionEvent e) { Script script = new SetupComponentWizard(SwingUtilities.getWindowAncestor(ScriptsPanel.this), api, scriptUIManager.getAvailableFieldsQuery()).showModal(); // Script script =new ScriptWizardActions(api,SwingUtilities.getWindowAncestor(ScriptsPanel.this)).promptUser(); if (script != null) { scriptUIManager.launchScriptEditor(script, null, isOkDirectory() ? directory : null); } } }); ret.add(new MyAction(SimpleActionConfig.editItem.setItemName("script"), false, false, true) { @Override public void actionPerformed(ActionEvent e) { ScriptNode node = scriptsTree.getSelectedValue(); if (node != null && node.isAvailable()) { ScriptsPanel.this.scriptUIManager.launchScriptEditor(node.getFile(), node.getLaunchEditorId()); } } }); ret.add(new MyAction(SimpleActionConfig.deleteItem.setItemName("script"), false, false, false) { @Override public void actionPerformed(ActionEvent e) { ScriptNode node = scriptsTree.getSelectedValue(); if (node == null) { return; } if (JOptionPane.showConfirmDialog(ScriptsPanel.this, "Really delete script " + node.getFile().getName() + " from disk?", "Delete script", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) { if (!node.getFile().delete()) { JOptionPane.showMessageDialog(ScriptsPanel.this, "Could not delete file"); } else { onDirectoryChanged(directory); } } } @Override public void updateEnabledState() { ScriptNode selected = scriptsTree.getSelectedValue(); boolean enabled = true; if (selected == null) { enabled = false; } if (enabled && selected.isScriptRoot() == false) { // can only delete the root enabled = false; } setEnabled(enabled); } }); ret.add(new MyAction(SimpleActionConfig.testCompileScript, true, false, true) { @Override public void actionPerformed(ActionEvent e) { ScriptNode node = scriptsTree.getSelectedValue(); if (node != null) { scriptUIManager.testCompileScript(node.getFile(), node.getLaunchExecutorId()); } } }); ret.add(new MyAction(SimpleActionConfig.runScript, true, true, true) { @Override public void actionPerformed(ActionEvent e) { ScriptNode node = scriptsTree.getSelectedValue(); if (node != null) { scriptUIManager.executeScript(node.getFile(), node.getLaunchExecutorId()); } } @Override public void updateEnabledState() { setEnabled(ScriptNode.isRunnable(scriptsTree.getSelectedValue(), scriptUIManager)); } }); } return ret; }
From source file:MyFormApp.java
private void RemovebuttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RemovebuttonMouseClicked // TODO add your handling code here:JDialog.setDefaultLookAndFeelDecorated(true); //?? ? ?//from w w w . jav a 2 s .c om int index = jList2.getSelectedIndex(); //?? int response = JOptionPane.showConfirmDialog(null, "Do you want to delete " + model.getElementAt(index) + " ?", "Confirm", //? JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) {//?? if (model.getSize() > 0) System.out.println(PATH + model.getElementAt(index));//? deleteDir(new File(PATH + model.getElementAt(index)));// pdf deleteDir(new File(PATH + model.getElementAt(index).getIconName() + ".png"));// model.removeElementAt(index);// LIST } }
From source file:com.emental.mindraider.ui.outline.OutlineArchiveJPanel.java
public void actionPerformed(ActionEvent e) { int result = JOptionPane.showConfirmDialog(MindRaider.mainJFrame, "Do you really want to delete all discarded Notes?", "Empty Archive", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { MindRaider.noteCustodian.deleteDiscardedConcepts(MindRaider.profile.getActiveOutlineUri().toString()); OutlineJPanel.getInstance().refresh(); }/*from w ww .ja v a 2 s. c om*/ }
From source file:model.settings.ReadSettings.java
/** * checks whether program information on current workspace exist. * @return if workspace is now set.// w ww . j a va 2s.c o m */ public static String install() { boolean installed = false; String wsLocation = ""; /* * does program root directory exist? */ if (new File(PROGRAM_LOCATION).exists()) { //try to read try { wsLocation = readFromFile(PROGRAM_SETTINGS_LOCATION); installed = new File(wsLocation).exists(); if (!installed) { wsLocation = ""; } } catch (FileNotFoundException e) { System.out.println("file not found " + e); showErrorMessage(); } catch (IOException e) { System.out.println("io" + e); showErrorMessage(); } } //if settings not found. if (!installed) { new File(PROGRAM_LOCATION).mkdir(); try { //create new file chooser JFileChooser jc = new JFileChooser(); //sets the text and language of all the components in JFileChooser UIManager.put("FileChooser.openDialogTitleText", "Open"); UIManager.put("FileChooser.lookInLabelText", "LookIn"); UIManager.put("FileChooser.openButtonText", "Open"); UIManager.put("FileChooser.cancelButtonText", "Cancel"); UIManager.put("FileChooser.fileNameLabelText", "FileName"); UIManager.put("FileChooser.filesOfTypeLabelText", "TypeFiles"); UIManager.put("FileChooser.openButtonToolTipText", "OpenSelectedFile"); UIManager.put("FileChooser.cancelButtonToolTipText", "Cancel"); UIManager.put("FileChooser.fileNameHeaderText", "FileName"); UIManager.put("FileChooser.upFolderToolTipText", "UpOneLevel"); UIManager.put("FileChooser.homeFolderToolTipText", "Desktop"); UIManager.put("FileChooser.newFolderToolTipText", "CreateNewFolder"); UIManager.put("FileChooser.listViewButtonToolTipText", "List"); UIManager.put("FileChooser.newFolderButtonText", "CreateNewFolder"); UIManager.put("FileChooser.renameFileButtonText", "RenameFile"); UIManager.put("FileChooser.deleteFileButtonText", "DeleteFile"); UIManager.put("FileChooser.filterLabelText", "TypeFiles"); UIManager.put("FileChooser.detailsViewButtonToolTipText", "Details"); UIManager.put("FileChooser.fileSizeHeaderText", "Size"); UIManager.put("FileChooser.fileDateHeaderText", "DateModified"); SwingUtilities.updateComponentTreeUI(jc); jc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jc.setMultiSelectionEnabled(false); final String informationMsg = "Please select the workspace folder. \n" + "By default, the new files are saved in there. \n\n" + "Is changed simply by using the Save-As option.\n" + "If no folder is specified, the default worspace folder \n" + "is the home directory of the current user."; final int response = JOptionPane.showConfirmDialog(jc, informationMsg, "Select workspace folder", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); final String defaultSaveLocation = System.getProperty("user.home") + System.getProperty("file.separator"); File f; if (response != JOptionPane.NO_OPTION) { //fetch selected file f = jc.getSelectedFile(); jc.showDialog(null, "select"); } else { f = new File(defaultSaveLocation); } printInformation(); if (f == null) { f = new File(defaultSaveLocation); } //if file selected if (f != null) { //if the file exists if (f.exists()) { writeToFile(PROGRAM_SETTINGS_LOCATION, ID_PROGRAM_LOCATION + "\n" + f.getAbsolutePath()); } else { //open message dialog JOptionPane.showConfirmDialog(null, "Folder does " + "not exist", "Error creating workspace", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null); } //recall install return install(); } } catch (IOException e) { System.out.println(e); JOptionPane.showConfirmDialog(null, "An exception occured." + " Try again later.", "Error creating workspace", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null); } } if (System.getProperty("os.name").equals("Mac OS X")) { installOSX(); } else if (System.getProperty("os.name").equals("Linux")) { installLinux(); } else if (System.getProperty("os.name").equals("Windows")) { installWindows(); } return wsLocation; }
From source file:emailplugin.MailCreator.java
/** * Shows a Warning if the Plugin was not configured correctly. * * @param parent Parent-Dialog//ww w . j a v a 2s . c o m */ private void showNotConfiguredCorrectly(Frame parent) { int ret = JOptionPane.showConfirmDialog(parent, mLocalizer.msg("NotConfiguredCorrectly", "Not configured correctly"), Localizer.getLocalization(Localizer.I18N_ERROR), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE); if (ret == JOptionPane.YES_OPTION) { Plugin.getPluginManager().showSettings(mPlugin); } }
From source file:com.clough.android.adbv.view.UpdateTableDialog.java
private void applyChangesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyChangesButtonActionPerformed // TODO add your handling code here: List<Row> rowsToInsert = rowController.getRowsToInsert(); List<Row> rowsToUpdate = rowController.getRowsToUpdate(); List<Row> rowsToDelete = rowController.getRowsToDelete(); int insertCount = rowsToInsert.size(); int updateCount = rowsToUpdate.size(); int deleteCount = rowsToDelete.size(); if (insertCount > 0 || updateCount > 0 || deleteCount > 0) { String message = "Inserting row count " + insertCount + "\n" + "Updating row count " + updateCount + "\n" + "Deleting row count " + deleteCount + "\n" + "Are you sure you want apply this changes?"; if (JOptionPane.showConfirmDialog(null, message, "Applying changes", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { mainFrame.setTableChangeList(rowsToChange, rowsToInsert, rowsToUpdate, rowsToDelete); dispose();//w w w . ja va 2 s . co m } } else { JOptionPane.showMessageDialog(null, "No changes to apply", "Applying changes", JOptionPane.INFORMATION_MESSAGE); dispose(); } }
From source file:gdt.jgui.entity.JEntitiesPanel.java
/** * Get context menu.// w w w .ja va 2s . c o m * @return the context menu. * */ @Override public JMenu getContextMenu() { menu = super.getContextMenu(); mia = null; int cnt = menu.getItemCount(); if (cnt > 0) { mia = new JMenuItem[cnt]; for (int i = 0; i < cnt; i++) mia[i] = menu.getItem(i); } menu.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { menu.removeAll(); if (mia != null) for (JMenuItem mi : mia) try { if (mi != null) menu.add(mi); } catch (Exception ee) { System.out.println("JEntitiesPanel:getConextMenu:" + ee.toString()); } Properties locator = Locator.toProperties(locator$); if (locator.getProperty(EntityHandler.ENTITY_CONTAINER) != null) { if (JEntityPrimaryMenu.hasToPaste(console, locator$)) { pasteItem = new JMenuItem("Paste components"); pasteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pasteComponents(); } }); menu.add(pasteItem); } if (hasSelectedItems()) { if (containerKey$ != null) { removeComponentsItem = new JMenuItem("Remove components"); removeComponentsItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeComponents(); } }); menu.add(removeComponentsItem); } } } if (locator.getProperty(EntityHandler.ENTITY_COMPONENT) != null) { if (componentKey$ != null) { removeContainersItem = new JMenuItem("Remove containers"); removeContainersItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeContainers(); } }); menu.add(removeContainersItem); } } if (hasSelectedItems()) { menu.addSeparator(); copyItem = new JMenuItem("Copy"); copyItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JItemPanel[] ipa = JEntitiesPanel.this.getItems(); ArrayList<String> sl = new ArrayList<String>(); for (JItemPanel ip : ipa) if (ip.isChecked()) sl.add(ip.getLocator()); String[] sa = sl.toArray(new String[0]); console.clipboard.clear(); for (String aSa : sa) console.clipboard.putString(aSa); } }); menu.add(copyItem); reindexItem = new JMenuItem("Reindex"); reindexItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JItemPanel[] ipa = JEntitiesPanel.this.getItems(); for (JItemPanel ip : ipa) if (ip.isChecked()) { JEntityPrimaryMenu.reindexEntity(console, ip.getLocator()); } } }); menu.add(reindexItem); archiveItem = new JMenuItem("Archive"); archiveItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JItemPanel[] ipa = JEntitiesPanel.this.getItems(); Entigrator entigrator = console.getEntigrator(entihome$); Properties locator; ArrayList<String> sl = new ArrayList<String>(); String entityKey$; for (JItemPanel ip : ipa) { if (ip.isChecked()) { locator = Locator.toProperties(ip.getLocator()); entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); sl.add(entityKey$); } } String[] sa = sl.toArray(new String[0]); System.out.println("JEntitiesPanel:archive:1"); String[] ea = JReferenceEntry.getCoalition(console, entigrator, sa); if (ea == null) System.out.println("JEntitiesPanel:archive:ea null"); else System.out.println("JEntitiesPanel:archive:ea=" + ea.length); JArchivePanel archivePanel = new JArchivePanel(); String apLocator$ = archivePanel.getLocator(); //locator$=getLocator(); apLocator$ = Locator.append(apLocator$, Entigrator.ENTIHOME, entihome$); apLocator$ = Locator.append(apLocator$, EntityHandler.ENTITY_LIST, Locator.toString(ea)); String icon$ = Support.readHandlerIcon(null, JEntityPrimaryMenu.class, "archive.png"); apLocator$ = Locator.append(apLocator$, Locator.LOCATOR_ICON, icon$); JConsoleHandler.execute(console, apLocator$); } }); menu.add(archiveItem); menu.addSeparator(); deleteItem = new JMenuItem("Delete"); deleteItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.YES_OPTION) { JItemPanel[] ipa = JEntitiesPanel.this.getItems(); Entigrator entigrator = console.getEntigrator(entihome$); String iLocator$; Properties iLocator; String iEntityKey$; String iEntityLabel$; Sack iEntity; ArrayList<String> sl = new ArrayList<String>(); for (JItemPanel ip : ipa) { iLocator$ = ip.getLocator(); iLocator = Locator.toProperties(iLocator$); iEntityLabel$ = iLocator.getProperty(EntityHandler.ENTITY_LABEL); if (ip.isChecked()) { iEntityKey$ = iLocator.getProperty(EntityHandler.ENTITY_KEY); iEntity = entigrator.getEntityAtKey(iEntityKey$); if (iEntity != null) entigrator.deleteEntity(iEntity); } else { sl.add(iEntityLabel$); } } String[] sa = sl.toArray(new String[0]); if (sa != null && sa.length > 0) { String sa$ = Locator.toString(sa); locator$ = Locator.append(locator$, EntityHandler.ENTITY_LIST, sa$); } JConsoleHandler.execute(console, locator$); } } }); menu.add(deleteItem); } } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); menu.addSeparator(); JMenuItem doneItem = new JMenuItem("Done"); doneItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (requesterResponseLocator$ != null) { try { byte[] ba = Base64.decodeBase64(requesterResponseLocator$); String responseLocator$ = new String(ba, "UTF-8"); JConsoleHandler.execute(console, responseLocator$); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } else console.back(); } }); menu.add(doneItem); return menu; }
From source file:com.diversityarrays.kdxplore.exportdata.CurationDataExporter.java
public void exportCurationData(ExportOptions options) { RowDataEmitter rowDataEmitter = null; boolean success = false; File tmpfile = null;/*from www . j av a 2 s .co m*/ File outputFile = options.file; List<PlotAttribute> plotAttributes = helper.getPlotAttributes(options.allPlotAttributes); List<TraitInstance> traitInstances = helper.getTraitInstances(options.whichTraitInstances); try { String loname = outputFile.getName().toLowerCase(); tmpfile = File.createTempFile(TEMPDIR_KDX, SUFFIX_TMP, outputFile.getParentFile()); if (loname.endsWith(SUFFIX_XLS)) { rowDataEmitter = new OldExcelRowDataEmitter(options, tmpfile, trial); } else if (loname.endsWith(SUFFIX_XLSX)) { // NOTE: BMS not supported for XLSX rowDataEmitter = new NewExcelRowDataEmitter(options, tmpfile, trial); } else { rowDataEmitter = new CsvRowDataEmitter(options, tmpfile); if (!loname.endsWith(SUFFIX_CSV)) { outputFile = new File(outputFile.getParentFile(), outputFile.getName() + SUFFIX_CSV); } } rowDataEmitter.emitTrialDetails(trialAttributes, plotAttributes, traitInstances); rowDataEmitter.emitSampleData(plotAttributes, traitInstances); success = true; } catch (IOException e) { JOptionPane.showMessageDialog(messageComponent, e.getMessage(), "I/O Error", JOptionPane.ERROR_MESSAGE); } finally { if (rowDataEmitter != null) { try { rowDataEmitter.close(); } catch (IOException ignore) { } } if (success) { if (outputFile.exists()) { outputFile.delete(); } if (tmpfile.renameTo(outputFile)) { messagePrinter.println("Exported data to " + outputFile.getPath()); if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(messageComponent, "Saved " + outputFile.getName(), "Open the saved file?", JOptionPane.YES_NO_OPTION)) { try { Util.openFile(outputFile); } catch (IOException e) { messagePrinter.println("Failed to open " + outputFile.getPath()); messagePrinter.println(e.getMessage()); } } } else { } } else { if (tmpfile != null) { tmpfile.delete(); } } } }
From source file:edu.harvard.mcz.imagecapture.jobs.JobCleanDirectory.java
private List<File> getFileList() { ArrayList<File> files = new ArrayList<File>(); String pathToCheck = ""; // Find the path in which to include files. File imagebase = null; // place to start the scan from, imagebase directory for SCAN_ALL File startPoint = null;//w ww. ja v a 2 s .com // If it isn't null, retrieve the image base directory from properties, and test for read access. if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE) == null) { JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "Can't start scan. Don't know where images are stored. Set imagbase property.", "Can't Scan.", JOptionPane.ERROR_MESSAGE); } else { imagebase = new File(Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE)); if (imagebase != null) { if (imagebase.canRead()) { startPoint = imagebase; } else { // If it can't be read, null out imagebase imagebase = null; } } if (scan == SCAN_SPECIFIC && startPointSpecific != null && startPointSpecific.canRead()) { // A scan start point has been provided, don't launch a dialog. startPoint = startPointSpecific; } if (imagebase == null || scan == SCAN_SELECT) { // launch a file chooser dialog to select the directory to scan final JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (scan == SCAN_SELECT && startPointSpecific != null && startPointSpecific.canRead()) { fileChooser.setCurrentDirectory(startPointSpecific); } else { if (Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_LASTPATH) != null) { fileChooser.setCurrentDirectory(new File(Singleton.getSingletonInstance().getProperties() .getProperties().getProperty(ImageCaptureProperties.KEY_LASTPATH))); } } int returnValue = fileChooser.showOpenDialog(Singleton.getSingletonInstance().getMainFrame()); if (returnValue == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); log.debug("Selected base directory: " + file.getName() + "."); startPoint = file; } else { //TODO: handle error condition log.error("Directory selection cancelled by user."); } } // Check that startPoint is or is within imagebase. if (!ImageCaptureProperties.isInPathBelowBase(startPoint)) { String base = Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE); log.error("Tried to scan directory (" + startPoint.getPath() + ") outside of base image directory (" + base + ")"); String message = "Can't scan and cleanup files outside of base image directory (" + base + ")"; JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), message, "Can't Scan outside image base directory.", JOptionPane.YES_NO_OPTION); } else if (ImageCaptureProperties.getPathBelowBase(startPoint).trim().length() == 0) { String base = Singleton.getSingletonInstance().getProperties().getProperties() .getProperty(ImageCaptureProperties.KEY_IMAGEBASE); log.error("Tried to scan directory (" + startPoint.getPath() + ") which is the base image directory."); String message = "Can only scan and cleanup files in a selected directory within the base directory (" + base + ").\nYou must select some subdirectory within the base directory to cleanup."; JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), message, "Can't Cleanup image base directory.", JOptionPane.YES_NO_OPTION); } else { if (!startPoint.canRead()) { JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(), "Can't start scan. Unable to read selected directory: " + startPoint.getPath(), "Can't Scan.", JOptionPane.YES_NO_OPTION); } else { pathToCheck = ImageCaptureProperties.getPathBelowBase(startPoint); // retrieve a list of image records in the selected directory ICImageLifeCycle ils = new ICImageLifeCycle(); List<ICImage> images = ils.findAllInDir(pathToCheck); Iterator<ICImage> iter = images.iterator(); while (iter.hasNext()) { ICImage image = iter.next(); File imageFile = new File( ImageCaptureProperties.assemblePathWithBase(image.getPath(), image.getFilename())); files.add(imageFile); counter.incrementFilesSeen(); } } } } log.debug("Found " + files.size() + " Image files in directory to check."); return files; }
From source file:at.becast.youploader.gui.FrmMain.java
/** * Creates new form frmMain/*from ww w .j a va 2 s . c o m*/ */ public FrmMain() { self = this; this.tos = false; this.setMinimumSize(new Dimension(900, 580)); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { LOG.info(Main.APP_NAME + " " + Main.VERSION + " closing.", FrmMain.class); Main.s.put("left", String.valueOf(getX())); Main.s.put("top", String.valueOf(getY())); Main.s.put("width", String.valueOf(getWidth())); Main.s.put("height", String.valueOf(getHeight())); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.stop(); e.getWindow().dispose(); } }); UploadMgr = UploadManager.getInstance(); TemplateMgr = TemplateManager.getInstance(); UploadMgr.setParent(this); String sspeed = Main.s.setting.get("speed"); if (sspeed != null) { speed = Integer.parseInt(sspeed); } else { speed = 0; } initComponents(); initMenuBar(); loadAccounts(); this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/yp.png"))); try { loadQueue(); } catch (SQLException | IOException e) { LOG.error("Error: ", e); } this.setVisible(true); if (Main.firstlaunch) { int n = JOptionPane.showConfirmDialog(null, LANG.getString("frmMain.initialAccount.Message"), LANG.getString("frmMain.initialAccount.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (n == JOptionPane.YES_OPTION) { mntmAddAccountActionPerformed(); } } else { PlaylistUpdater pu = new PlaylistUpdater(this); Thread updater = new Thread(pu); updater.start(); AccountUpdater au = new AccountUpdater(this); Thread aupdater = new Thread(au); aupdater.start(); } EditPanel edit = (EditPanel) ss1.contentPane; if (edit.getCmbTemplate().getModel().getSize() > 0) { edit.getCmbTemplate().setSelectedIndex(0); } tray = new TrayManager(this); addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent e) { if (e.getNewState() == ICONIFIED) { tray.add(); setVisible(false); } if (e.getNewState() == 7) { tray.add(); setVisible(false); } if (e.getNewState() == MAXIMIZED_BOTH) { tray.remove(); setVisible(true); } if (e.getNewState() == NORMAL) { tray.remove(); setVisible(true); } } }); }