Java Code Examples for javax.swing.plaf.basic.BasicGraphicsUtils#getPreferredButtonSize()
The following examples show how to use
javax.swing.plaf.basic.BasicGraphicsUtils#getPreferredButtonSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DarkButtonUI.java From darklaf with MIT License | 5 votes |
@Override public Dimension getPreferredSize(final JComponent c) { AbstractButton b = (AbstractButton) c; prepareDelegate(b); Dimension dim = BasicGraphicsUtils.getPreferredButtonSize(layoutDelegate, b.getIconTextGap()); if (ButtonConstants.isSquare(b)) { int size = Math.max(dim.width, dim.height); dim.setSize(size, size); } return dim; }
Example 2
Source File: ButtonUI.java From RipplePower with Apache License 2.0 | 5 votes |
public Dimension getPreferredSize(JComponent c) { AbstractButton b = (AbstractButton) c; Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, b.getIconTextGap()); Insets margin = b.getMargin(); d.setSize(d.getWidth() + margin.left + margin.right, d.getHeight() + margin.top + margin.bottom); return d; }
Example 3
Source File: NavlinkUI.java From RipplePower with Apache License 2.0 | 5 votes |
public Dimension getPreferredSize(JComponent c) { AbstractButton b = (AbstractButton) c; Dimension d = BasicGraphicsUtils.getPreferredButtonSize(b, b.getIconTextGap()); Insets margin = b.getMargin(); d.setSize(d.getWidth() + margin.left + margin.right, d.getHeight() + margin.top + margin.bottom); return d; }
Example 4
Source File: DarculaButtonUI.java From consulo with Apache License 2.0 | 5 votes |
@Override public final Dimension getPreferredSize(JComponent c) { AbstractButton b = (AbstractButton)c; int textIconGap = StringUtil.isEmpty(b.getText()) || b.getIcon() == null ? 0 : b.getIconTextGap(); Dimension size = BasicGraphicsUtils.getPreferredButtonSize(b, textIconGap); return getDarculaButtonSize(c, size); }