@Override public int getIconWidth() { return layers[0].getIconWidth(); }
@Override public int getIconWidth() { return this.delegate.getIconWidth(); }
@Override public int getIconWidth() { return delegate.getIconWidth(); }
@Override public int getIconWidth() { return delegate.getIconWidth(); }
@Override public int getIconWidth() { return currentIcon.getIconWidth(); }
@Override public void setDimension(Dimension dim) { for (ResizableIcon icon : iconDeck.values()) { int currH = icon.getIconHeight(); int currW = icon.getIconWidth(); if ((currH != dim.height) || (currW != dim.width)) icon.setDimension(dim); } }
@Override public Point getKeyTipAnchorCenterPoint(AbstractCommandButton commandButton) { Insets ins = commandButton.getInsets(); int height = commandButton.getHeight(); ResizableIcon buttonIcon = commandButton.getIcon(); // bottom-right corner of the icon area return new Point(ins.left + buttonIcon.getIconWidth(), height - ins.top - ins.bottom); }
@Override public Point getKeyTipAnchorCenterPoint(AbstractCommandButton commandButton) { Insets ins = commandButton.getInsets(); int height = commandButton.getHeight(); ResizableIcon buttonIcon = commandButton.getIcon(); if (buttonIcon != null) { // bottom-right corner of the icon area return new Point(ins.left + buttonIcon.getIconWidth(), (height + buttonIcon.getIconHeight()) / 2); } else { // bottom-left corner of the button return new Point(ins.left, 3 * height / 4); } }
@Override public Point getKeyTipAnchorCenterPoint(AbstractCommandButton commandButton) { Insets ins = commandButton.getInsets(); int height = commandButton.getHeight(); ResizableIcon buttonIcon = commandButton.getIcon(); if (buttonIcon != null) { // bottom-right corner of the icon area return new Point(ins.left + buttonIcon.getIconWidth(), (height + buttonIcon.getIconHeight()) / 2); } else { // bottom-left corner of the button return new Point(ins.left, 3 * height / 4); } }
@Override public Point getKeyTipAnchorCenterPoint(AbstractCommandButton commandButton) { Insets ins = commandButton.getInsets(); int height = commandButton.getHeight(); ResizableIcon buttonIcon = commandButton.getIcon(); // bottom-right corner of the icon area return new Point(ins.left + buttonIcon.getIconWidth(), (height + buttonIcon.getIconHeight()) / 2); }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { this.delegate.paintIcon(c, g, x, y); for (IconDecorator decorator : this.decorators) { decorator.paintIconDecoration(c, g, x, y, this.delegate .getIconWidth(), this.delegate.getIconHeight()); } }
/** * Sets new icon for this button. Fires an <code>icon</code> property change * event. * * @param defaultIcon * New default icon for this button. * @see #setDisabledIcon(ResizableIcon) * @see #getIcon() */ public void setIcon(ResizableIcon defaultIcon) { ResizableIcon oldValue = this.icon; this.icon = defaultIcon; firePropertyChange("icon", oldValue, defaultIcon); if (defaultIcon != oldValue) { if (defaultIcon == null || oldValue == null || defaultIcon.getIconWidth() != oldValue.getIconWidth() || defaultIcon.getIconHeight() != oldValue.getIconHeight()) { revalidate(); } repaint(); } }
@Override public Dimension getPreferredSize(RibbonElementPriority priority) { Insets ins = ribbonComponent.getInsets(); JComponent mainComponent = ribbonComponent.getMainComponent(); Dimension prefMain = mainComponent.getPreferredSize(); int width = ins.left; int height = prefMain.height; if (isIconVisible(priority)) { ResizableIcon icon = ribbonComponent.getIcon(); if (icon != null) { width += (icon.getIconWidth() + getLayoutGap()); height = Math.max(height, icon.getIconHeight()); } } if (isCaptionVisible(priority)) { Dimension prefCaption = captionLabel.getPreferredSize(); width += (prefCaption.width + getLayoutGap()); height = Math.max(height, prefCaption.height); } width += prefMain.width; width += ins.right; height += (ins.top + ins.bottom); return new Dimension(width, height); } }
.getIconHeight()) / 2; result.iconRect.x = (width - buttonIcon.getIconWidth()) / 2; result.iconRect.y = y; result.iconRect.width = buttonIcon.getIconWidth(); result.iconRect.height = buttonIcon.getIconHeight(); y += buttonIcon.getIconHeight();
.getIconHeight()) / 2; result.iconRect.x = (width - buttonIcon.getIconWidth()) / 2; result.iconRect.y = y; result.iconRect.width = buttonIcon.getIconWidth(); result.iconRect.height = buttonIcon.getIconHeight(); y += buttonIcon.getIconHeight();
int iconWidth = (icon == null) ? 0 : icon.getIconWidth(); int width = Math.max(iconWidth, Math.max(title1Width, title2Width + 4
@Override public Dimension minimumLayoutSize(Container parent) { Insets ins = ribbonComponent.getInsets(); JComponent mainComponent = ribbonComponent.getMainComponent(); Dimension minMain = mainComponent.getMinimumSize(); int width = ins.left; int height = minMain.height; if (isIconVisible(ribbonComponent.getDisplayPriority())) { ResizableIcon icon = ribbonComponent.getIcon(); if (icon != null) { width += (icon.getIconWidth() + getLayoutGap()); height = Math.max(height, icon.getIconHeight()); } } if (isCaptionVisible(ribbonComponent.getDisplayPriority())) { Dimension minCaption = captionLabel.getMinimumSize(); width += (minCaption.width + getLayoutGap()); height = Math.max(height, minCaption.height); } width += minMain.width; width += ins.right; height += (ins.top + ins.bottom); return new Dimension(width, height); }
protected void syncDisabledIcon() { ResizableIcon currDisabledIcon = this.commandButton.getDisabledIcon(); ResizableIcon icon = this.commandButton.getIcon(); if ((currDisabledIcon == null) || (currDisabledIcon instanceof UIResource)) { if (icon != null) { this.commandButton.setDisabledIcon(new ResizableIconUIResource( new FilteredResizableIcon(icon, new ColorConvertOp( ColorSpace.getInstance(ColorSpace.CS_GRAY), null)))); } else { this.commandButton.setDisabledIcon(null); } } else { // disabled icon coming from app code if (icon != null) { this.commandButton.getDisabledIcon() .setDimension( new Dimension(icon.getIconWidth(), icon .getIconHeight())); } } }
@Override public void paint(Graphics g, JComponent c) { JRibbonComponent ribbonComp = (JRibbonComponent) c; if (isIconVisible(this.ribbonComponent.getDisplayPriority())) { Insets ins = ribbonComp.getInsets(); ResizableIcon icon = ribbonComp.isEnabled() ? ribbonComp.getIcon() : this.disabledIcon; if (icon != null) { int availableHeight = ribbonComp.getHeight() - ins.top - ins.bottom; int iconY = Math.max(0, ins.top + (availableHeight - icon.getIconHeight()) / 2); if (ribbonComp.getComponentOrientation().isLeftToRight()) { paintIcon(g, ribbonComp, icon, ins.left, iconY); } else { paintIcon(g, ribbonComp, icon, ribbonComp.getWidth() - ins.right - icon.getIconWidth(), iconY); } } } }
if (ribbonComp.getIcon() != null) { int iconW = ribbonComp.getIcon().getIconWidth(); x = ltr ? x + iconW + gap : x - iconW - gap;