Search in sources :

Example 46 with EmptyBorder

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)));
        }
    }
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder)

Example 47 with EmptyBorder

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();
            }
        });
    }
}
Also used : com.intellij.openapi.util(com.intellij.openapi.util) AccessibleContextUtil(com.intellij.util.ui.accessibility.AccessibleContextUtil) Wrapper(com.intellij.ui.components.panels.Wrapper) AllIcons(com.intellij.icons.AllIcons) HyperlinkEvent(javax.swing.event.HyperlinkEvent) Area(java.awt.geom.Area) Rectangle2D(java.awt.geom.Rectangle2D) HashSet(com.intellij.util.containers.HashSet) FocusRequestor(com.intellij.openapi.wm.FocusRequestor) ShadowBorderPainter(com.intellij.openapi.ui.impl.ShadowBorderPainter) Balloon(com.intellij.openapi.ui.popup.Balloon) RGBImageFilter(java.awt.image.RGBImageFilter) LightweightWindowEvent(com.intellij.openapi.ui.popup.LightweightWindowEvent) IdeGlassPaneUtil(com.intellij.openapi.wm.IdeGlassPaneUtil) NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) BufferedImage(java.awt.image.BufferedImage) com.intellij.ide(com.intellij.ide) Set(java.util.Set) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) RoundRectangle2D(java.awt.geom.RoundRectangle2D) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager) com.intellij.util.ui(com.intellij.util.ui) java.awt.event(java.awt.event) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) ApplicationManager(com.intellij.openapi.application.ApplicationManager) EmptyBorder(javax.swing.border.EmptyBorder) Registry(com.intellij.openapi.util.registry.Registry) GeneralPath(java.awt.geom.GeneralPath) NotNull(org.jetbrains.annotations.NotNull) RelativePoint(com.intellij.ui.awt.RelativePoint) ImageFilter(java.awt.image.ImageFilter) Consumer(com.intellij.util.Consumer) DataContext(com.intellij.openapi.actionSystem.DataContext) GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig) ScreenReader(com.intellij.util.ui.accessibility.ScreenReader) ActionManager(com.intellij.openapi.actionSystem.ActionManager) AnActionListener(com.intellij.openapi.actionSystem.ex.AnActionListener) JdkConstants(org.intellij.lang.annotations.JdkConstants) JBPopupListener(com.intellij.openapi.ui.popup.JBPopupListener) AnAction(com.intellij.openapi.actionSystem.AnAction) java.awt(java.awt) MnemonicHelper(com.intellij.openapi.MnemonicHelper) ObjectUtils(com.intellij.util.ObjectUtils) IdeGlassPaneEx(com.intellij.openapi.wm.impl.IdeGlassPaneEx) Collections(java.util.Collections) Alarm(com.intellij.util.Alarm) javax.swing(javax.swing) NotNull(org.jetbrains.annotations.NotNull) List(java.util.List) EmptyBorder(javax.swing.border.EmptyBorder)

Example 48 with EmptyBorder

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;
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder)

Example 49 with EmptyBorder

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);
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder)

Example 50 with EmptyBorder

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;
}
Also used : ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) CommonActionsManager(com.intellij.ide.CommonActionsManager) EmptyBorder(javax.swing.border.EmptyBorder) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Aggregations

EmptyBorder (javax.swing.border.EmptyBorder)224 JPanel (javax.swing.JPanel)96 BorderLayout (java.awt.BorderLayout)87 JLabel (javax.swing.JLabel)70 JButton (javax.swing.JButton)44 JScrollPane (javax.swing.JScrollPane)44 Insets (java.awt.Insets)37 Dimension (java.awt.Dimension)35 Border (javax.swing.border.Border)30 GridBagLayout (java.awt.GridBagLayout)29 ActionEvent (java.awt.event.ActionEvent)27 ActionListener (java.awt.event.ActionListener)27 TitledBorder (javax.swing.border.TitledBorder)25 GridBagConstraints (java.awt.GridBagConstraints)24 Box (javax.swing.Box)22 JTextField (javax.swing.JTextField)21 CompoundBorder (javax.swing.border.CompoundBorder)20 BoxLayout (javax.swing.BoxLayout)17 FlowLayout (java.awt.FlowLayout)16 JCheckBox (javax.swing.JCheckBox)16