use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.
the class TabLabel method apply.
public void apply(UiDecorator.UiDecoration decoration) {
if (decoration == null) {
return;
}
if (decoration.getLabelFont() != null) {
setFont(decoration.getLabelFont());
getLabelComponent().setFont(decoration.getLabelFont());
}
Insets insets = decoration.getLabelInsets();
if (insets != null) {
Insets current = JBTabsImpl.ourDefaultDecorator.getDecoration().getLabelInsets();
if (current != null) {
setBorder(new EmptyBorder(getValue(current.top, insets.top), getValue(current.left, insets.left), getValue(current.bottom, insets.bottom), getValue(current.right, insets.right)));
}
}
}
use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.
the class BalloonImpl method createComponent.
private void createComponent() {
myComp = new MyComponent(myContent, this, myShadowBorderProvider != null ? null : myShowPointer ? myPosition.createBorder(this) : getPointlessBorder());
if (myActionProvider == null) {
final Consumer<MouseEvent> listener = event -> {
SwingUtilities.invokeLater(() -> hide());
};
myActionProvider = new ActionProvider() {
private ActionButton myCloseButton;
@NotNull
@Override
public List<ActionButton> createActions() {
myCloseButton = new CloseButton(listener);
return Collections.singletonList(myCloseButton);
}
@Override
public void layout(@NotNull Rectangle lpBounds) {
if (!myCloseButton.isVisible()) {
return;
}
Icon icon = getCloseButton();
int iconWidth = icon.getIconWidth();
int iconHeight = icon.getIconHeight();
Rectangle r = new Rectangle(lpBounds.x + lpBounds.width - iconWidth + (int) (iconWidth * 0.3), lpBounds.y - (int) (iconHeight * 0.3), iconWidth, iconHeight);
Insets border = getShadowBorderInsets();
r.x -= border.left;
r.y -= border.top;
myCloseButton.setBounds(r);
}
};
}
myComp.clear();
myComp.myAlpha = isAnimationEnabled() ? 0f : -1;
myComp.setBorder(new EmptyBorder(getShadowBorderInsets()));
myLayeredPane.add(myComp);
// the second balloon must be over the first one
myLayeredPane.setLayer(myComp, getLayer(), 0);
myPosition.updateBounds(this);
if (myBlockClicks) {
myComp.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
e.consume();
}
@Override
public void mousePressed(MouseEvent e) {
e.consume();
}
@Override
public void mouseReleased(MouseEvent e) {
e.consume();
}
});
}
}
use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.
the class BalloonImpl method getPreferredSize.
@Override
public Dimension getPreferredSize() {
if (myComp != null) {
return myComp.getPreferredSize();
}
if (myDefaultPrefSize == null) {
final EmptyBorder border = myShadowBorderProvider == null ? getPointlessBorder() : null;
final MyComponent c = new MyComponent(myContent, this, border);
if (myShadowBorderProvider != null) {
c.setBorder(new EmptyBorder(getShadowBorderInsets()));
}
myDefaultPrefSize = c.getPreferredSize();
}
return myDefaultPrefSize;
}
use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.
the class CardActionsPanel method createCardForGroup.
private void createCardForGroup(ActionGroup group, String cardId, final String parentId) {
JPanel card = new JPanel(new BorderLayout());
if (!USE_ICONS) {
card.setOpaque(false);
}
JPanel withBottomFiller = new JPanel(new BorderLayout());
if (!USE_ICONS) {
withBottomFiller.setOpaque(true);
withBottomFiller.setBackground(Color.white);
}
withBottomFiller.add(card, BorderLayout.NORTH);
myContent.add(withBottomFiller, cardId);
List<JComponent> components = buildComponents(group, cardId);
JPanel componentsPanel = new JPanel(new GridLayout(components.size(), 1, 5, 5));
if (!USE_ICONS) {
componentsPanel.setOpaque(false);
}
componentsPanel.setBorder(new EmptyBorder(15, 15, 15, 15));
for (JComponent component : components) {
componentsPanel.add(component);
}
card.add(componentsPanel, BorderLayout.CENTER);
String title;
title = group.getTemplatePresentation().getText();
card.add(new HeaderPanel(title, parentId), BorderLayout.NORTH);
}
use of javax.swing.border.EmptyBorder in project intellij-community by JetBrains.
the class XFramesView method createToolbar.
private ActionToolbarImpl createToolbar() {
final DefaultActionGroup framesGroup = new DefaultActionGroup();
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesList));
framesGroup.add(actionsManager.createNextOccurenceAction(myFramesList));
framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP));
final ActionToolbarImpl toolbar = (ActionToolbarImpl) ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
toolbar.setReservePlaceAutoPopupIcon(false);
toolbar.setAddSeparatorFirst(true);
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
return toolbar;
}
Aggregations