Example #1
0
  public IdeaTitledBorder(String title, int indent, Insets insets) {
    super(title);
    titledSeparator = new TitledSeparator(title);
    titledSeparator.setText(title);
    DialogUtil.registerMnemonic(titledSeparator.getLabel(), null);

    this.outsideInsets = new Insets(insets.top, insets.left, insets.bottom, insets.right);

    this.insideInsets = new Insets(TitledSeparator.BOTTOM_INSET, indent, 0, 0);
  }
    public void addButtonRunnable(int index, final Runnable runnable, String text) {
      if (getBorder() == null) setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));

      final JButton button = new JButton(UIUtil.replaceMnemonicAmpersand(text));
      DialogUtil.registerMnemonic(button);

      button.setFocusable(false);
      button.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              runnable.run();
            }
          });

      add(button, index);

      invalidate();
      if (getParent() != null) {
        getParent().validate();
      }
    }