List of usage examples for javax.swing JOptionPane NO_OPTION
int NO_OPTION
To view the source code for javax.swing JOptionPane NO_OPTION.
Click Source Link
From source file:view.WorkspacePanel.java
public void setDocument(Document document) { if (null == document) { this.document = null; topToolbar.setVisible(false);// w w w.j a va 2 s. c om bottomToolbar.setVisible(false); imagePanel.clear(); status = Status.READY; btnPageBackward.setEnabled(false); btnPageForward.setEnabled(false); lblTip.setVisible(true); removeTempSignature(); hideRightPanel(); } else { if (status.equals(Status.SIGNING)) { String msg = Bundle.getBundle().getString("msg.signatureStillNotAppliedOpenOther"); Object[] options = { Bundle.getBundle().getString("yes"), Bundle.getBundle().getString("no") }; int opt = JOptionPane.showOptionDialog(null, msg, "", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (opt == JOptionPane.NO_OPTION) { return; } } lblTip.setVisible(false); this.document = document; imagePanel.setDocumentAndComponents(mainWindow, jsImagePanel, document, btnPageBackward, btnPageForward); } jSplitPane1.setDividerSize(0); }
From source file:volker.streaming.music.gui.NowPlayingFrame.java
public NowPlayingFrame(final File cfgFile) { this.cfgFile = cfgFile; frame = this; setTitle("NowPlaying - LastFM integration"); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); lastfmConfig = LastFmConfig.fromFile(cfgFile); config = Config.fromFile(cfgFile);/*from w w w .j a v a 2s . co m*/ configPanel = new ConfigPanel(this, lastfmConfig); previewTrack = new Track("Beyonce", "Halo", "I Am... Sasha Fierce"); formatter = new Formatter(Formatter.DEFAULT_EXCEPTIONS); formatPanel = new FormatPanel(this, config, formatter, previewTrack); apiPanel = new ApiPanel(config, lastfmConfig, formatter); saveButton = new JButton("Save configuration"); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveConfig(); } }); savePanel = new JPanel(new GridBagLayout()); savePanel.add(saveButton); layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(configPanel) .addComponent(formatPanel).addComponent(apiPanel).addComponent(savePanel)) .addContainerGap()); layout.setVerticalGroup(layout.createSequentialGroup().addContainerGap().addComponent(configPanel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(formatPanel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(apiPanel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(savePanel).addContainerGap()); pack(); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { LastFmConfig storedLfm = LastFmConfig.fromFile(cfgFile); Config stored = Config.fromFile(cfgFile); if (!stored.contentEquals(config) || !storedLfm.contentEquals(lastfmConfig)) { int opt = JOptionPane.showConfirmDialog(frame, "You have unsaved configuration changes.\nDo you want to save them?", "Unsaved changes", JOptionPane.YES_NO_CANCEL_OPTION); switch (opt) { case JOptionPane.YES_OPTION: saveConfig(); case JOptionPane.NO_OPTION: System.exit(0); break; case JOptionPane.CANCEL_OPTION: break; default: LOG.error("Unknown response to closing window"); } } else { System.exit(0); } } }); }