Example #1
0
  public SimpleDialog(String title, String description, String helpUrl, boolean okAndCancel) {
    super(UISupport.getMainFrame(), title, true);

    buttons = UISupport.initDialogActions(buildActions(helpUrl, okAndCancel), this);
    buttons.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    getContentPane()
        .add(
            UISupport.buildDescription(
                title, description, UISupport.createImageIcon(UISupport.TOOL_ICON_PATH)),
            BorderLayout.NORTH);

    getContentPane().add(buildContent(), BorderLayout.CENTER);

    buttons.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(
                BorderFactory.createMatteBorder(1, 0, 0, 0, Color.GRAY),
                BorderFactory.createMatteBorder(1, 0, 0, 0, Color.WHITE)),
            BorderFactory.createEmptyBorder(3, 5, 3, 5)));

    getContentPane().add(buttons, BorderLayout.SOUTH);
    modifyButtons();

    pack();
  }
Example #2
0
    public ContentDialog(String title, String description) throws HeadlessException {
      super(UISupport.getMainFrame());
      setTitle(title);
      setModal(true);

      getContentPane().setLayout(new BorderLayout());
      JLabel label = new JLabel(description);
      label.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
      getContentPane().add(label, BorderLayout.NORTH);
      getContentPane().add(buildContent(), BorderLayout.CENTER);

      ButtonBarBuilder builder = ButtonBarBuilder.createLeftToRightBuilder();
      builder.addGlue();
      JButton closeButton = new JButton(new CloseAction());
      builder.addFixed(closeButton);

      builder.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
      getContentPane().add(builder.getPanel(), BorderLayout.SOUTH);

      pack();

      UISupport.initDialogActions(this, null, closeButton);
    }