Java Code Examples for javax.swing.AbstractButton#setBorder()
The following examples show how to use
javax.swing.AbstractButton#setBorder() .
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: BEButtonUI.java From beautyeye with Apache License 2.0 | 6 votes |
protected void installDefaults(AbstractButton b) { super.installDefaults(b); b.setOpaque(false); if(!defaults_initialized) { String pp = getPropertyPrefix(); dashedRectGapX = UIManager.getInt(pp + "dashedRectGapX"); dashedRectGapY = UIManager.getInt(pp + "dashedRectGapY"); dashedRectGapWidth = UIManager.getInt(pp + "dashedRectGapWidth"); dashedRectGapHeight = UIManager.getInt(pp + "dashedRectGapHeight"); focusColor = UIManager.getColor(pp + "focus"); defaults_initialized = true; } // BEXPStyle xp = BEXPStyle.getXP(); // if (xp != null) { b.setBorder(new XPEmptyBorder(new Insets(3,3,3,3)));//xp.getBorder(b, getXPButtonType(b))); LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE); } }
Example 2
Source File: XDMMenuItemUI.java From xdm with GNU General Public License v2.0 | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); c.setBorder(null); if (c instanceof AbstractButton) { AbstractButton btn = (AbstractButton) c; btn.setBorder(new EmptyBorder(getScaledInt(5), getScaledInt(10), getScaledInt(5), getScaledInt(10))); btn.setBorderPainted(false); } }
Example 3
Source File: XDMMenuUI.java From xdm with GNU General Public License v2.0 | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); if (c instanceof AbstractButton) { AbstractButton btn = (AbstractButton) c; // btn.setMargin(new Insets(10,10,10,10)); btn.setBorder(new EmptyBorder(getScaledInt(5), getScaledInt(10), getScaledInt(5), getScaledInt(10))); // btn.setIcon(new XDMBlankIcon(15, 10)); btn.setBorderPainted(false); // btn.setMargin(new Insets(10, 10, 10, 10)); // btn.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); } }
Example 4
Source File: BlueishButtonUI.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
public void installUI(JComponent c) { super.installUI(c); AbstractButton button = (AbstractButton)c; button.setRolloverEnabled(true); button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); }
Example 5
Source File: IconPackagerButtonBarUI.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
public void installUI(JComponent c) { super.installUI(c); AbstractButton button = (AbstractButton)c; button.setOpaque(false); button.setRolloverEnabled(true); button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); }
Example 6
Source File: RapidDockingToolbar.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void installButtonUI(AbstractButton button) { button.setUI(new ButtonUI()); button.setBorder(null); button.setMargin(new Insets(0, 0, 0, 0)); if ((button.getText() == null || "".equals(button.getText())) && button.getIcon() != null) { button.setPreferredSize(new Dimension((int) (button.getIcon().getIconWidth() * 1.45d), (int) (button.getIcon() .getIconHeight() * 1.45d))); } }
Example 7
Source File: StyledButtonUI.java From stendhal with GNU General Public License v2.0 | 5 votes |
@Override protected void paintButtonPressed(Graphics graphics, AbstractButton button) { // Try to avoid switching borders if the button has none, or custom // borders if (style.getBorder().equals(button.getBorder())) { button.setBorder(style.getBorderDown()); } }
Example 8
Source File: BlueishButtonUI.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
public void installUI(JComponent c) { super.installUI(c); AbstractButton button = (AbstractButton)c; button.setRolloverEnabled(true); button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); }
Example 9
Source File: SlidingTabDisplayerButtonUI.java From netbeans with Apache License 2.0 | 4 votes |
/** Install a border on the button */ protected void installBorder (AbstractButton b) { b.setBorder (BorderFactory.createEtchedBorder()); }
Example 10
Source File: SlidingTabDisplayerButtonUI.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected void installBorder (AbstractButton b) { b.setBorder (BorderFactory.createEmptyBorder (5,2,2,2)); }
Example 11
Source File: ActionManager.java From audiveris with GNU Affero General Public License v3.0 | 4 votes |
/** * Allocate and dress an instance of the provided class, then register the action in * the UI structure (menus and buttons) according to the action descriptor parameters. * * @param action the provided action class * @return the registered and decorated instance of the action class */ @SuppressWarnings("unchecked") private ApplicationAction registerAction (ActionDescriptor desc) { ///logger.info("registerAction. " + desc); ApplicationAction action = null; try { // Retrieve proper class instance Class<?> classe = classLoader.loadClass(desc.className); Object instance = null; // Reuse existing instance through a 'getInstance()' method if any try { Method getInstance = classe.getDeclaredMethod("getInstance", (Class[]) null); if (Modifier.isStatic(getInstance.getModifiers())) { instance = getInstance.invoke(null); } } catch (NoSuchMethodException ignored) { } if (instance == null) { // Fall back to allocate a new class instance instance = classe.newInstance(); } // Retrieve the action instance action = getActionInstance(instance, desc.methodName); if (action != null) { // Insertion of a button on Tool Bar? if (desc.buttonClassName != null) { Class buttonClass = classLoader.loadClass(desc.buttonClassName); AbstractButton button = (AbstractButton) buttonClass.newInstance(); button.setAction(action); toolBar.add(button); button.setBorder(UIUtil.getToolBorder()); button.setText(""); } } else { logger.error("Unknown action {} in class {}", desc.methodName, desc.className); } } catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InstantiationException | SecurityException | InvocationTargetException ex) { logger.warn("Error while registering " + desc, ex); } return action; }
Example 12
Source File: JButtonFactory.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
private static void setButtonProperties(AbstractButton button) { button.setBorder(new RoundedBorder(5)); button.setForeground(ColorPalette.FOREGROUND_COLOR); button.setFont(Fonts.FONT); }
Example 13
Source File: ActionManager.java From libreveris with GNU Lesser General Public License v3.0 | 4 votes |
/** * Allocate and dress an instance of the provided class, then * register the action in the UI structure (menus and buttons) * according to the action descriptor parameters. * * @param action the provided action class * @return the registered and decorated instance of the action class */ @SuppressWarnings("unchecked") private ApplicationAction registerAction (ActionDescriptor desc) { ///logger.info("registerAction. " + desc); ApplicationAction action = null; try { // Retrieve proper class instance Class<?> classe = classLoader.loadClass(desc.className); Object instance = null; // Reuse existing instance through a 'getInstance()' method if any try { Method getInstance = classe.getDeclaredMethod( "getInstance", (Class[]) null); if (Modifier.isStatic(getInstance.getModifiers())) { instance = getInstance.invoke(null); } } catch (NoSuchMethodException ignored) { } if (instance == null) { // Fall back to allocate a new class instance ///logger.warn("instantiating instance of " + classe); instance = classe.newInstance(); } // Retrieve the action instance action = getActionInstance(instance, desc.methodName); if (action != null) { // Insertion of a button on Tool Bar? if (desc.buttonClassName != null) { Class<? extends AbstractButton> buttonClass = (Class<? extends AbstractButton>) classLoader. loadClass(desc.buttonClassName); AbstractButton button = buttonClass.newInstance(); button.setAction(action); toolBar.add(button); button.setBorder(UIUtil.getToolBorder()); button.setText(""); } } else { logger.error("Unknown action {} in class {}", desc.methodName, desc.className); } } catch (ClassNotFoundException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) { logger.warn("Error while registering " + desc, ex); } return action; }
Example 14
Source File: GraphPanel.java From chipster with MIT License | 4 votes |
private void initialiseToolBarButton(AbstractButton button) { button.addActionListener(this); button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); }
Example 15
Source File: ToolBarComponentFactory.java From chipster with MIT License | 4 votes |
public static void initialiseButton(AbstractButton button, boolean leftBorder, boolean rightBorder){ button.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0,leftBorder?1:0,0,rightBorder?1:0,Color.LIGHT_GRAY), BorderFactory.createEmptyBorder(4,4,4,4))); }