myCaption.setButtonComponent(new InplaceButton(
new IconButton("Open as Tool Window",
AllIcons.General.AutohideOff, AllIcons.General.AutohideOff, AllIcons.General.AutohideOffInactive),
- new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- pinCallback.process(AbstractPopup.this);
- }
- }
- ));
+ e -> pinCallback.process(this)
+ ), JBUI.Borders.empty(4));
}
else if (cancelButton != null) {
- myCaption.setButtonComponent(new InplaceButton(cancelButton, new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- cancel();
- }
- }));
+ myCaption.setButtonComponent(new InplaceButton(cancelButton, e -> cancel()), JBUI.Borders.empty(4));
}
else if (commandButton != null) {
- myCaption.setButtonComponent(commandButton);
+ myCaption.setButtonComponent(commandButton, null);
}
}
else {
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import javax.swing.border.EmptyBorder;
+import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.MouseEvent;
repaint();
}
- public void setButtonComponent(@NotNull ActiveComponent component) {
+ public void setButtonComponent(@NotNull ActiveComponent component, @Nullable Border border) {
if (myButtonComponent != null) {
remove(myButtonComponent.getComponent());
}
JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(border);
panel.add(new JLabel(" "), BorderLayout.WEST);
panel.add(component.getComponent(), BorderLayout.CENTER);
panel.setOpaque(false);