javax.swing.AbstractButton#setBorder ( )源码实例Demo

下面列出了javax.swing.AbstractButton#setBorder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: beautyeye   文件: BEButtonUI.java
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);
		}
	}
 
源代码2 项目: xdm   文件: XDMMenuItemUI.java
@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);
	}
}
 
源代码3 项目: xdm   文件: XDMMenuUI.java
@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));
	}
}
 
源代码4 项目: orbit-image-analysis   文件: BlueishButtonUI.java
public void installUI(JComponent c) {
  super.installUI(c);

  AbstractButton button = (AbstractButton)c;
  button.setRolloverEnabled(true);
  button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
}
 
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));
}
 
源代码6 项目: rapidminer-studio   文件: RapidDockingToolbar.java
@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)));
	}
}
 
源代码7 项目: stendhal   文件: StyledButtonUI.java
@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());
	}
}
 
源代码8 项目: CodenameOne   文件: BlueishButtonUI.java
public void installUI(JComponent c) {
  super.installUI(c);

  AbstractButton button = (AbstractButton)c;
  button.setRolloverEnabled(true);
  button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
}
 
源代码9 项目: netbeans   文件: SlidingTabDisplayerButtonUI.java
/** Install a border on the button */
protected void installBorder (AbstractButton b) {
    b.setBorder (BorderFactory.createEtchedBorder());
}
 
源代码10 项目: netbeans   文件: SlidingTabDisplayerButtonUI.java
@Override
protected void installBorder (AbstractButton b) {
    b.setBorder (BorderFactory.createEmptyBorder (5,2,2,2));
}
 
源代码11 项目: audiveris   文件: ActionManager.java
/**
 * 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;
}
 
源代码12 项目: WorldGrower   文件: JButtonFactory.java
private static void setButtonProperties(AbstractButton button) {
	button.setBorder(new RoundedBorder(5));
	button.setForeground(ColorPalette.FOREGROUND_COLOR);
	button.setFont(Fonts.FONT);
}
 
源代码13 项目: libreveris   文件: ActionManager.java
/**
 * 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;
}
 
源代码14 项目: chipster   文件: GraphPanel.java
private void initialiseToolBarButton(AbstractButton button) {
	button.addActionListener(this);
	button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
}
 
源代码15 项目: chipster   文件: ToolBarComponentFactory.java
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)));
}