/** Show the filter dialog */
 public void showDialog() {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   include_panel =
       new ServiceFilterPanel("Include messages based on target service:", filter_include_list);
   exclude_panel =
       new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list);
   status_box = new JCheckBox("Filter messages based on status:");
   status_box.addActionListener(this);
   status_active = new JRadioButton("Active messages only");
   status_active.setSelected(true);
   status_active.setEnabled(false);
   status_complete = new JRadioButton("Complete messages only");
   status_complete.setEnabled(false);
   status_group = new ButtonGroup();
   status_group.add(status_active);
   status_group.add(status_complete);
   if (filter_active || filter_complete) {
     status_box.setSelected(true);
     status_active.setEnabled(true);
     status_complete.setEnabled(true);
     if (filter_complete) {
       status_complete.setSelected(true);
     }
   }
   status_options = new JPanel();
   status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS));
   status_options.add(status_active);
   status_options.add(status_complete);
   status_options.setBorder(indent_border);
   status_panel = new JPanel();
   status_panel.setLayout(new BorderLayout());
   status_panel.add(status_box, BorderLayout.NORTH);
   status_panel.add(status_options, BorderLayout.CENTER);
   status_panel.setBorder(empty_border);
   ok_button = new JButton("Ok");
   ok_button.addActionListener(this);
   cancel_button = new JButton("Cancel");
   cancel_button.addActionListener(this);
   buttons = new JPanel();
   buttons.setLayout(new FlowLayout());
   buttons.add(ok_button);
   buttons.add(cancel_button);
   panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
   panel.add(include_panel);
   panel.add(exclude_panel);
   panel.add(status_panel);
   panel.add(buttons);
   dialog = new JDialog();
   dialog.setTitle("SOAP Monitor Filter");
   dialog.setContentPane(panel);
   dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   dialog.setModal(true);
   dialog.pack();
   Dimension d = dialog.getToolkit().getScreenSize();
   dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2);
   ok_pressed = false;
   dialog.show();
 }
  /**
   * Show the dialog box. The dialog is automatically centered on the parent window, or on the
   * screen if there is no parent.
   *
   * <p>This method always returns immediately after showing the dialog box. However, if the dialog
   * has a parent, the dialog defaults to modal. When modal, interaction with the application will
   * be blocked until this dialog box is closed by calling the hide() method. If the dialog has no
   * parent, it is not modal and application interaction is not blocked.
   *
   * <p>While the dialog box is up, an internal thread monitors changes to the dialog box's
   * parameters and keeps the dialog drawn and uptodate.
   */
  public void show() {
    // Center
    final Rectangle windowDim = this.getBounds();
    int x, y;
    if (this.parent == null) {
      // Center on the screen.
      final Toolkit toolkit = Toolkit.getDefaultToolkit();
      final Dimension screenDim = toolkit.getScreenSize();
      x = screenDim.width / 2 - windowDim.width / 2;
      y = screenDim.height / 2 - windowDim.height / 2;
    } else {
      // Center on the parent.
      final Rectangle parentDim = this.parent.getBounds();
      x = parentDim.x + parentDim.width / 2 - windowDim.width / 2;
      y = parentDim.y + parentDim.height / 2 - windowDim.height / 2;
    }
    if (x < 0) {
      x = 0;
    }
    if (y < 0) {
      y = 0;
    }
    this.setLocation(x, y);

    // If the dialog box is not modal, just call the
    // superclass's show method.  That method returns
    // quickly, and then we return.
    if (this.isModal() == false) {
      super.show();
      return;
    }

    // Otherwise the dialog is modal.  Start a thread
    // to show the dialog box.  That thread will block
    // waiting for the dialog box to be hidden.
    final ProgressDialog thisDialog = this;
    final Thread showThread =
        new Thread(
            new Runnable() {
              public void run() {
                // Doesn't return until dialog is hidden.
                thisDialog.showIt();
              }
            });
    showThread.start();

    // Return, leaving the dialog box up.
  }
 /** Show the dialog box via the superclass. This method is only called by the show thread. */
 private void showIt() {
   super.show();
 }