Package javax.swing

Examples of javax.swing.JOptionPane$ClosingInternalFrameListener$Lock


    super(name);
  }

  protected boolean downloadFrom(final String url) throws TvBrowserException {
    if(!isStable() && Settings.propPluginBetaWarning.getBoolean()) {
      JOptionPane pane = new JOptionPane();
     
      String ok = mLocalizer.msg("betawarning.oktext","Install beta version");
      String cancel = mLocalizer.msg("betawarning.canceltext","Cancel installation");
     
      pane.setOptions(new String[] {ok,cancel});
      pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
      pane.setOptionType(JOptionPane.YES_NO_OPTION);
      pane.setInitialValue(cancel);
      pane.setMessage(mLocalizer.msg("betawarning.text","<html>The plugin <b>{0}</b> is a beta version.<br>Beta versions are possible unstable and could contain errors.<br><br>Are you sure that you want to install this version?</html>",getName() + " " + getVersion()));
     
      Window w = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
     
      JDialog dialog = pane.createDialog(w, mLocalizer.msg("betawarning.title","Beta version"));
      dialog.setModal(true);
      dialog.setLocationRelativeTo(w);
      dialog.setVisible(true);
     
      if(!ok.equals(pane.getValue())) {
        return false;
      }
    }

    final File toFile=new File(Settings.propPluginsDirectory.getString(),getClassName() + ".jar.inst");
View Full Code Here


    gc.anchor = GridBagConstraints.LINE_START;
    gb.setConstraints(label, gc); panel.add(label);
    gb.setConstraints(field, gc); panel.add(field);
    gb.setConstraints(error, gc); panel.add(error);
    gb.setConstraints(strut, gc); panel.add(strut);
    JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE,
        JOptionPane.OK_CANCEL_OPTION);
    pane.setInitialValue(field);
    JDialog dlog = pane.createDialog(frame, Strings.get("circuitNameDialogTitle"));
    dlog.addWindowFocusListener(new WindowFocusListener() {
      public void windowGainedFocus(WindowEvent arg0) {
        field.requestFocus();
      }

      public void windowLostFocus(WindowEvent arg0) { }
    });
   
    while (true) {
      field.selectAll();
      dlog.pack();
      dlog.setVisible(true);
      field.requestFocusInWindow();
      Object action = pane.getValue();
      if (action == null || !(action instanceof Integer)
          || ((Integer) action).intValue() != JOptionPane.OK_OPTION) {
        return null;
      }
View Full Code Here

   
    JPanel main = new JPanel(new BorderLayout());
    mFrame.setContentPane(main);

    msg = mLocalizer.msg("error.message", "No browser found.\n\nDo you want to choose a browser now?");
    mOptionPane = new JOptionPane(msg, JOptionPane.ERROR_MESSAGE, JOptionPane.YES_NO_OPTION);
    mOptionPane.addPropertyChangeListener(new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        if (evt.getPropertyName().equals(JOptionPane.VALUE_PROPERTY) &&
            evt.getNewValue() != null &&
            evt.getNewValue() != JOptionPane.UNINITIALIZED_VALUE)
View Full Code Here

     * @param parent  component that dialog is modal on
     * @param body    body text of dialog
     * @param title   title of dialog
     */
    public static void modalError(Component parent, String body, String title) {
        JOptionPane errorDialog = new JOptionPane();
        errorDialog.showMessageDialog(parent, body, title, JOptionPane.ERROR_MESSAGE);
    }
View Full Code Here

        e.printStackTrace();
        modalError(parent, body, title);
    }
   
    public static void nonModalError(String body, String title, Exception e) {
        JOptionPane errorDialog = new JOptionPane();
        errorDialog.showMessageDialog(null, body, title, JOptionPane.ERROR_MESSAGE);
    }
View Full Code Here

    private boolean overwriteDialog(String oldValue, String newValue,
            String fieldName) {
        boolean retval = false;
        Object[] possibilities = { "Yes", "Yes to All", "No", "No to All" };

        final JOptionPane optionPane = new JOptionPane(
                "Do you want to overwrite the value '" + oldValue
                        + "' \nwith the value '" + newValue + "' \nfor the "
                        + fieldName + " field?", JOptionPane.QUESTION_MESSAGE,
                JOptionPane.DEFAULT_OPTION, null, possibilities, "No");

        final JDialog dialog = new JDialog(panel.frame(), "Overwrite Value",
                true);
        dialog.setContentPane(optionPane);
        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

        optionPane.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
                String prop = e.getPropertyName();

                if (dialog.isVisible() && (e.getSource() == optionPane)
                        && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
                    //If you were going to check something
                    //before closing the window, you'd do
                    //it here.
                    dialog.setVisible(false);
                }
            }
        });
        dialog.pack();
        dialog.setVisible(true);

        String userChoice = (String) optionPane.getValue();
        if (userChoice.equals("Yes to All")) {
            overwriteAll.setValue(true);
            retval = true;
        } else if (userChoice.equals("Yes")) {
            retval = true;
View Full Code Here

    nameTextField.setText("Test");
    tester.click(areaVisibleCheckBox);
    tester.click(floorVisibleCheckBox);
    tester.click(ceilingVisibleCheckBox);
   
    final JOptionPane attributesOptionPane = (JOptionPane)TestUtilities.findComponent(
        attributesDialog, JOptionPane.class);
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Select Ok option to hide dialog box in Event Dispatch Thread
          attributesOptionPane.setValue(JOptionPane.OK_OPTION);
        }
      });
    assertFalse("Dialog still showing", attributesDialog.isShowing());
   
    // Assert room was modified accordingly
View Full Code Here

  /**
   * Cliks on OK in dialog to close it.
   */
  private void doClickOnOkInDialog(JDialog dialog, JComponentTester tester)
            throws ComponentSearchException {
    final JOptionPane attributesOptionPane = (JOptionPane)TestUtilities.findComponent(
        dialog, JOptionPane.class);
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Select Ok option to hide dialog box in Event Dispatch Thread
          attributesOptionPane.setValue(JOptionPane.OK_OPTION);
        }
      });
    assertFalse("Dialog still showing", dialog.isShowing());
  }
View Full Code Here

  /**
   * Clicks on OK in dialog to close it.
   */
  private void doClickOnOkInDialog(JDialog dialog, JComponentTester tester)
            throws ComponentSearchException {
    final JOptionPane attributesOptionPane = (JOptionPane)TestUtilities.findComponent(
        dialog, JOptionPane.class);
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Select Ok option to hide dialog box in Event Dispatch Thread
          if (attributesOptionPane.getOptions() != null) {
            attributesOptionPane.setValue(attributesOptionPane.getOptions() [0]);
          } else {
            attributesOptionPane.setValue(JOptionPane.OK_OPTION);
          }
        }
      });
    assertFalse("Dialog still showing", dialog.isShowing());
  }
View Full Code Here

      SwingUtilities.getWindowAncestor(VideoPanel.this).toFront();
    } else {
      if (currentVideoPanel != null) {
        currentVideoPanel.close();
      }
      final JOptionPane optionPane = new JOptionPane(this,
          JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION,
          null, new Object [] {this.createButton, this.saveButton, this.closeButton}, this.createButton);
      if (parentView != null) {
        optionPane.setComponentOrientation(((JComponent)parentView).getComponentOrientation());
      }
      final JDialog dialog = optionPane.createDialog(SwingUtilities.getRootPane((Component)parentView), this.dialogTitle);
      dialog.setModal(false);
     
      Component homeRoot = SwingUtilities.getRoot((Component)parentView);
      if (homeRoot != null) {
        // Restore location if it exists
        Integer x = (Integer)this.home.getVisualProperty(VIDEO_DIALOG_X_VISUAL_PROPERTY);
        Integer y = (Integer)this.home.getVisualProperty(VIDEO_DIALOG_Y_VISUAL_PROPERTY);     

        int windowRightBorder = homeRoot.getX() + homeRoot.getWidth();
        Dimension screenSize = getToolkit().getScreenSize();
        Insets screenInsets = getToolkit().getScreenInsets(getGraphicsConfiguration());
        int screenRightBorder = screenSize.width - screenInsets.right;
        // Check dialog isn't too high
        int screenHeight = screenSize.height - screenInsets.top - screenInsets.bottom;
        if (OperatingSystem.isLinux() && screenHeight == screenSize.height) {
          // Let's consider that under Linux at least an horizontal bar exists
          screenHeight -= 30;
        }
        int screenBottomBorder = screenSize.height - screenInsets.bottom;
        int dialogWidth = dialog.getWidth();
        if (dialog.getHeight() > screenHeight) {
          dialog.setSize(dialogWidth, screenHeight);
        }
        int dialogHeight = dialog.getHeight();
        if (x != null && y != null
            && x + dialogWidth <= screenRightBorder
            && y + dialogHeight <= screenBottomBorder) {
          dialog.setLocation(x, y);
        } else if (screenRightBorder - windowRightBorder > dialogWidth / 2
            || dialogHeight == screenHeight) {
          // If there some space left at the right of the window
          // move the dialog to the right of window
          dialog.setLocationByPlatform(false);
          dialog.setLocation(Math.min(windowRightBorder + 5, screenRightBorder - dialogWidth),
              Math.max(Math.min(homeRoot.getY() + dialog.getInsets().top,
                  screenSize.height - dialogHeight - screenInsets.bottom), screenInsets.top));
        } else {
          dialog.setLocationByPlatform(true);
        }
      } else {
        dialog.setLocationByPlatform(true);
      }
     
      dialog.addWindowListener(new WindowAdapter() {
        public void windowClosed(WindowEvent ev) {
          stopVideoCreation(false);
          if (playbackTimer != null) {
            pausePlayback();
          }
          if (videoFile != null) {
            videoFile.delete();
          }
          currentVideoPanel = null;
        }
      });
     
      updateAdvancedComponents();
      ToolTipManager.sharedInstance().registerComponent(this.qualitySlider);
      dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
      dialog.addComponentListener(new ComponentAdapter() {
          @Override
          public void componentHidden(ComponentEvent ev) {
            if (optionPane.getValue() != null
                && optionPane.getValue() != JOptionPane.UNINITIALIZED_VALUE) {
              close();
            }
          }

          @Override
View Full Code Here

TOP

Related Classes of javax.swing.JOptionPane$ClosingInternalFrameListener$Lock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.