/**
   * DOCUMENT ME!
   *
   * @param e DOCUMENT ME!
   */
  @Override
  public void actionPerformed(final ActionEvent e) {
    final WizardDescriptor wizard = new WizardDescriptor(getPanels());
    wizard.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizard.setTitle(
        NbBundle.getMessage(
            ImportGeoCPMWizardAction.class, "ImportGeoCPMWizardAction.wizard.title")); // NOI18N

    final Dialog dialog = DialogDisplayer.getDefault().createDialog(wizard);
    dialog.pack();
    dialog.setLocationRelativeTo(ComponentRegistry.getRegistry().getMainWindow());
    dialog.setVisible(true);
    dialog.toFront();

    final boolean cancelled = wizard.getValue() != WizardDescriptor.FINISH_OPTION;

    if (cancelled) {
      for (final Object o : getPanels()) {
        if (o instanceof Cancellable) {
          ((Cancellable) o).cancel();
        }
      }
    }
    // there is no need to do anything, when finished successfully
  }
  public void showDifferences(DiffView diffView) {
    Frame window = WindowManager.getDefault().getMainWindow();

    if (dialog == null) {
      DialogDescriptor descriptor = dialogDescriptor(diffPanel);
      dialog = org.openide.DialogDisplayer.getDefault().createDialog(descriptor);
      dialog.setSize(640, 480);
    }
    diffPanel.setDiffView(diffView);
    dialog.setLocationRelativeTo(window);
    dialog.setVisible(true);
  }
示例#3
0
  void showWarning(Frame frame, String warning) {
    warningDialog = new Dialog(frame, "警告", true);
    warningDialog.setSize(200, 100);
    warningDialog.setLayout(new FlowLayout());
    warningDialog.setResizable(false);
    warningDialog.setLocationRelativeTo(frame);

    warningText = new Label(warning);
    warningButton = new Button("确认");

    warningDialog.add(warningText);
    warningDialog.add(warningButton);

    warningDialog.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            warningDialog.setVisible(false);
            warningDialog.dispose();
          }
        });

    warningButton.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            int keyCode = e.getKeyCode();

            if (keyCode == KeyEvent.VK_ENTER) {
              warningDialog.setVisible(false);
              warningDialog.dispose();
            }
          }
        });

    warningButton.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            warningDialog.setVisible(false);
            warningDialog.dispose();
          }
        });

    warningDialog.setVisible(true);
  }