javax.swing.AbstractButton.setMargin()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中javax.swing.AbstractButton.setMargin()方法的一些代码示例,展示了AbstractButton.setMargin()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractButton.setMargin()方法的具体详情如下:
包路径:javax.swing.AbstractButton
类名称:AbstractButton
方法名:setMargin

AbstractButton.setMargin介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

b.setMargin(new Insets(1, 4, 1, 4));
b.setFocusable(false);
panel.add(b, constraints);

代码示例来源:origin: ballerina-platform/ballerina-lang

rootPanel.add(spacer10, new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
alwaysSendRequestsCheckBox = new JCheckBox();
alwaysSendRequestsCheckBox.setMargin(new Insets(2, 2, 2, 2));
alwaysSendRequestsCheckBox.setText("Always send requests");
alwaysSendRequestsCheckBox.setToolTipText("Send requests even if a language plugin already supports it");

代码示例来源:origin: stackoverflow.com

for (int jj = 0; jj < chessBoardSquares[ii].length; jj++) {
  JButton b = new JButton();
  b.setMargin(buttonMargin);

代码示例来源:origin: stackoverflow.com

b.setMargin(new Insets(1, 4, 1, 4));
b.setFocusable(false);

代码示例来源:origin: stackoverflow.com

private static final long serialVersionUID = 9204819004142223529L;
    setMargin(new Insets(0, 0, 0, 0));
statusPanel.add(new JButton("Slide Right") {
    setMargin(new Insets(0, 0, 0, 0));
statusPanel.add(new JButton("Slide Up") {
    setMargin(new Insets(0, 0, 0, 0));
statusPanel.add(new JButton("Slide Down") {
    setMargin(new Insets(0, 0, 0, 0));

代码示例来源:origin: net.sf.tinylaf/tinylaf

IconButton(Icon icon) {
    super(icon);
    
    setFocusPainted(false);
    setMargin(new Insets(2, 2, 2, 2));
  }
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

public void decoreToolBarButton(final AbstractButton _r){
  _r.setText("");
  _r.setMargin(new Insets(0, 0, 0, 0));
 }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Removes the button border.
 *
 * @param button the button
 */
public static void removeButtonBorder(AbstractButton button) {
  button.setContentAreaFilled(false);
  button.setMargin(new Insets(0, 0, 0, 0));
  button.setBorder(BorderFactory.createEmptyBorder());
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

protected JButton createArrowButton() {
  JButton button = new TinyComboBoxButton(comboBox,
    null,
    comboBox.isEditable(),
    currentValuePane,
    listBox);
  button.setMargin(DEFAULT_INSETS);
  button.putClientProperty("isComboBoxButton", Boolean.TRUE);
  
  return button;
}

代码示例来源:origin: pentaho/pentaho-reporting

public Component getListCellRendererComponent( final JList list, final Object value, final int index,
   final boolean isSelected, final boolean cellHasFocus ) {
  defaultComp.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
  abstractButton.setSelected( isSelected );
  abstractButton.setText( String.valueOf( value ) );
  abstractButton.setFont( new Font( Font.DIALOG, Font.PLAIN, 10 ) );
  abstractButton.setMargin( new Insets( 2, 0, 3, 0 ) );

  return this;
 }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

public void addButton(AbstractButton button) {
  Icon icon = button.getIcon();
  Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 10);
  button.setMinimumSize(size);
  button.setPreferredSize(size);
  button.setMaximumSize(size);
  button.setMargin(new Insets(5, 4, 5, 4));
  toolbar.add(button);
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

/**
 * Create a new ScrollButton.
 * @see javax.swing.plaf.metal.MetalScrollButton#MetalScrollButton(int, int, boolean)
 */
public TinyScrollButton(int direction,TinyScrollBarUI scrollbarUI) {
  super(direction);
  this.scrollbarUI = scrollbarUI;
  setBorder(null);
  setRolloverEnabled(true);
  setMargin(new Insets(0, 0, 0, 0));
  setSize(getPreferredSize());
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

private void decoreButton(final AbstractButton _bt) {
 _bt.setRequestFocusEnabled(false);
 _bt.setMargin(INSETS1111);
 _bt.addActionListener(this);
}

代码示例来源:origin: BaseXdb/basex

/**
 * Unifies the button style.
 * @param button button reference
 * @return button
 */
private static AbstractButton style(final AbstractButton button) {
 // no shadow effects (flat style)
 button.setOpaque(false);
 // trim horizontal button margins (mac)
 final Insets in = button.getMargin();
 in.left /= 4;
 in.right /= 4;
 if(in.top < in.left) button.setMargin(in);
 return button;
}

代码示例来源:origin: freeplane/freeplane

public static void configureToolbarButtonSize(final AbstractButton abstractButton) {
    if (System.getProperty("os.name").equals("Mac OS X")) {
      abstractButton.putClientProperty("JButton.buttonType", "segmented");
      abstractButton.putClientProperty("JButton.segmentPosition", "middle");
      final Dimension buttonSize = new Dimension(22, 22);
      abstractButton.setPreferredSize(buttonSize);
      abstractButton.setFocusPainted(false);
    }
    abstractButton.setFocusable(false);
    abstractButton.setMargin(FreeplaneToolBar.nullInsets);
  }
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

protected void uninstallDefaults() {
  LookAndFeel.uninstallBorder(menuItem);
  menuItem.setBorderPainted(oldBorderPainted);
  
  if(menuItem.getMargin() instanceof UIResource) menuItem.setMargin(null);
  if(arrowIcon instanceof UIResource) arrowIcon = null;
  if(checkIcon instanceof UIResource) checkIcon = null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

protected void addImpl(Component comp, Object constraints, int index) {
  if (comp instanceof AbstractButton) {
    AbstractButton ab = (AbstractButton) comp;
    ab.setContentAreaFilled(false);
    ab.setMargin(new Insets(3, 3, 3, 3));
    if (buttonStyle == BUTTON_STYLE_VERICAL) {
      ab.setVerticalTextPosition(SwingConstants.BOTTOM);
      ab.setHorizontalTextPosition(SwingConstants.CENTER);
    }
  }
  super.addImpl(comp, constraints, index);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
protected void addImpl(Component comp, Object constraints, int index) {
  if (comp instanceof AbstractButton) {
    AbstractButton ab = (AbstractButton) comp;
    ab.setContentAreaFilled(false);
    ab.setMargin(new Insets(3, 3, 3, 3));
    if (buttonStyle == BUTTON_STYLE_VERICAL) {
      ab.setVerticalTextPosition(SwingConstants.BOTTOM);
      ab.setHorizontalTextPosition(SwingConstants.CENTER);
    }
  }
  super.addImpl(comp, constraints, index);
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

@Override
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);
  b.setMargin(new Insets(5, 3, 5, 3));
  b.setRolloverEnabled(true); // Not true by default.
  b.setFocusable(false); // Prevent JRootPane default button issues
  b.setBorder(new ButtonBorder());
  b.setOpaque(false);
  colors.initialize(b);
  b.putClientProperty("breadcrumbBorderColor", colors.borderColor);
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

@Override
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);
  b.setMargin(new Insets(5, 4, 5, 4));
  b.setBorder(new ButtonBorder());
  b.setRolloverEnabled(true); // Not true by default
  b.setFocusable(false); // Prevent JRootPane default button issues
  b.setOpaque(false);
  colors.initialize(b);
  b.putClientProperty("breadcrumbBorderColor", colors.borderColor);
}

相关文章

微信公众号

最新文章

更多

AbstractButton类方法