本文整理了Java中javax.swing.AbstractButton.getBorder()
方法的一些代码示例,展示了AbstractButton.getBorder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractButton.getBorder()
方法的具体详情如下:
包路径:javax.swing.AbstractButton
类名称:AbstractButton
方法名:getBorder
暂无
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
/**
* {@inheritDoc}
*/
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
if (b.getBorder() == null || b.getBorder() instanceof UIResource) {
b.setBorder(new BorderUIResource(BorderFactory.createEmptyBorder(0, 1, 0, 0)));
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
protected void setBorderToRollover(Component c) {
if (c instanceof AbstractButton) {
AbstractButton b = (AbstractButton) c;
if (b.getBorder() instanceof UIResource) {
b.setBorder(myRolloverBorder);
}
b.setRolloverEnabled(true);
}
}
}
代码示例来源:origin: stackoverflow.com
protected void setBorderToRollover(Component c) {
if (c instanceof AbstractButton) {
AbstractButton b = (AbstractButton)c;
Border border = borderTable.get(b);
if (border == null || border instanceof UIResource) {
borderTable.put(b, b.getBorder());
}
// Only set the border if its the default border
if (b.getBorder() instanceof UIResource) {
b.setBorder(getRolloverBorder(b));
}
rolloverTable.put(b, b.isRolloverEnabled()?
Boolean.TRUE: Boolean.FALSE);
b.setRolloverEnabled(true);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers
@Override
protected void setBorderToRollover(Component c) {
if (c instanceof AbstractButton) {
AbstractButton b = (AbstractButton) c;
if (b.getBorder() instanceof UIResource) {
b.setBorder(myRolloverBorder);
}
b.setRolloverEnabled(true);
}
}
}
代码示例来源:origin: org.jclarion/clarion-runtime
public static void init(AbstractButton button)
{
Border b = button.getBorder();
button.setBorder(new FlatBorder(button,b));
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/** Paints the specified button in the pressed state.
*
* @param g Graphics context into which to paint
* @param c The button which is to be painted
*/
protected void paintButtonPressed(Graphics g, AbstractButton b)
{
Border border=b.getBorder();
if(border==null || !(border instanceof ToolBarBorder))
{
Insets insets=b.getInsets();
g.setColor(activeBorder);
g.drawRect(insets.left, insets.top, b.getWidth()-insets.left-insets.right-1, b.getHeight()-insets.top-insets.bottom-1);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
if (!b.isContentAreaFilled() || (b.getParent() instanceof JMenuBar)) {
return;
}
int width = b.getWidth();
int height = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new Rectangle2D.Double(1, 1, width - 2, height - 2));
if (savedClip != null) {
clipArea.intersect(new Area(savedClip));
}
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
代码示例来源:origin: BaseXdb/basex
/**
* Returns a new image button.
* @param icon name of image icon
* @param toggle toggle flag
* @param tooltip tooltip text
* @param gui reference to the main window
* @return button
*/
public static AbstractButton get(final String icon, final String tooltip, final boolean toggle,
final GUI gui) {
final AbstractButton button = toggle ? new JToggleButton() : new JButton();
init(button, icon, tooltip, gui);
if(!toggle) {
button.setBorder(TEMPLATE.getBorder());
button.setMargin(TEMPLATE.getMargin());
}
return button;
}
代码示例来源:origin: org.basex/basex
/**
* Returns a new image button.
* @param icon name of image icon
* @param toggle toggle flag
* @param tooltip tooltip text
* @param gui reference to the main window
* @return button
*/
public static AbstractButton get(final String icon, final String tooltip, final boolean toggle,
final GUI gui) {
final AbstractButton button = toggle ? new JToggleButton() : new JButton();
init(button, icon, tooltip, gui);
if(!toggle) {
button.setBorder(TEMPLATE.getBorder());
button.setMargin(TEMPLATE.getMargin());
}
return button;
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
super.paintBackground(g, b);
if (b.isContentAreaFilled() && b.isRolloverEnabled() && b.getModel().isRollover() && b.isBorderPainted() && (b.getBorder() != null)) {
g.setColor(AbstractLookAndFeel.getFocusColor());
g.drawLine(1, 1, b.getWidth() - 1, 1);
g.drawLine(1, 2, b.getWidth() - 1, 2);
g.drawLine(1, 3, b.getWidth() - 1, 3);
}
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) {
super.paintBackground(g, b);
} else {
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
int w = b.getWidth();
int h = b.getHeight();
Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, w - 1, h - 1, 6, 6));
clipArea.intersect(new Area(savedClip));
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/** Paints the specified button in the pressed state.
*
* @param g Graphics context into which to paint
* @param c The button which is to be painted
*/
protected void paintButtonPressed(Graphics g, AbstractButton b)
{
Border border=b.getBorder();
if(border==null || !(border instanceof ToolBarBorder))
{
Insets insets=b.getInsets();
g.setColor(highlightColor);
g.drawLine(insets.left, b.getHeight()-insets.top-insets.bottom, b.getWidth()-insets.left-insets.right, b.getHeight()-insets.top-insets.bottom);
g.drawLine(b.getWidth()-insets.left-insets.right, insets.top, b.getWidth()-insets.left-insets.right, b.getHeight()-insets.top-insets.bottom);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
Graphics2D g2D = (Graphics2D) g;
int width = b.getWidth();
int height = b.getHeight();
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()
|| !b.isContentAreaFilled()
|| !(b.getBorder() instanceof UIResource)
|| ((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) {
g.setColor(AbstractLookAndFeel.getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, 4, 3, width - 8, height - 6);
} else {
Object savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2D.setColor(AbstractLookAndFeel.getFocusColor());
int d = height - 6;
g2D.drawRoundRect(2, 2, width - 7, height - 7, d, d);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRenderingHint);
}
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
Graphics2D g2D = (Graphics2D) g;
int width = b.getWidth();
int height = b.getHeight();
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()
|| !b.isContentAreaFilled()
|| !(b.getBorder() instanceof UIResource)
|| ((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) {
g.setColor(AbstractLookAndFeel.getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, 4, 3, width - 8, height - 6);
} else {
Object savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2D.setColor(AbstractLookAndFeel.getFocusColor());
int d = b.getHeight() - 4;
g2D.drawRoundRect(2, 2, b.getWidth() - 5, b.getHeight() - 5, d, d);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRenderingHint);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
Graphics2D g2D = (Graphics2D) g;
int width = b.getWidth();
int height = b.getHeight();
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()
|| !b.isContentAreaFilled()
|| !(b.getBorder() instanceof UIResource)
|| ((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) {
g.setColor(AbstractLookAndFeel.getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, 4, 3, width - 8, height - 6);
} else {
Object savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2D.setColor(AbstractLookAndFeel.getFocusColor());
int d = b.getHeight() - 4;
g2D.drawRoundRect(2, 2, b.getWidth() - 5, b.getHeight() - 5, d, d);
g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRenderingHint);
}
}
}
代码示例来源:origin: org.java.net.substance/substance
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
button.setRolloverEnabled(true);
Border border = b.getBorder();
if (border == null || border instanceof UIResource) {
b.setBorder(SubstanceSizeUtils.getCheckBoxBorder(SubstanceSizeUtils
.getComponentFontSize(b), b.getComponentOrientation()
.isLeftToRight()));
}
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
button.setRolloverEnabled(true);
Border border = b.getBorder();
if (border == null || border instanceof UIResource) {
b.setBorder(SubstanceSizeUtils.getCheckBoxBorder(SubstanceSizeUtils
.getComponentFontSize(b), b.getComponentOrientation()
.isLeftToRight()));
}
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
LookAndFeel.installProperty(b, "opaque", false);
b.setBorderPainted(false);
b.setRolloverEnabled(true);
if (SwingXUtilities.isUIInstallable(b.getBorder())) {
b.setBorder(new BorderUIResource(BorderFactory.createEmptyBorder(0, 1, 0, 0)));
}
dashedRectGapX = UIManager.getInt("ButtonUI.dashedRectGapX");
dashedRectGapY = UIManager.getInt("ButtonUI.dashedRectGapY");
dashedRectGapWidth = UIManager.getInt("ButtonUI.dashedRectGapWidth");
dashedRectGapHeight = UIManager.getInt("ButtonUI.dashedRectGapHeight");
focusColor = UIManager.getColor("ButtonUI.focus");
b.setHorizontalAlignment(AbstractButton.LEADING);
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
Border border = b.getBorder();
if (border == null || border instanceof UIResource) {
b.setBorder(SubstanceSizeUtils.getRadioButtonBorder(
SubstanceSizeUtils.getComponentFontSize(b), b
.getComponentOrientation().isLeftToRight()));
}
button.setRolloverEnabled(true);
LookAndFeel.installProperty(b, "iconTextGap", SubstanceSizeUtils
.getTextIconGap(SubstanceSizeUtils.getComponentFontSize(b)));
}
代码示例来源:origin: org.java.net.substance/substance
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
Border border = b.getBorder();
if (border == null || border instanceof UIResource) {
b.setBorder(SubstanceSizeUtils.getRadioButtonBorder(
SubstanceSizeUtils.getComponentFontSize(b), b
.getComponentOrientation().isLeftToRight()));
}
button.setRolloverEnabled(true);
LookAndFeel.installProperty(b, "iconTextGap", SubstanceSizeUtils
.getTextIconGap(SubstanceSizeUtils.getComponentFontSize(b)));
}
内容来源于网络,如有侵权,请联系作者删除!