javax.swing.JButton.getUI()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(136)

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

JButton.getUI介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-netbeans-swing-plaf

private static Object getSynthContext () {
  try {
    JButton dummyButton = getDummyButton();
    
    if (synthUI.isAssignableFrom(dummyButton.getUI().getClass())) {
      return synthUI_getContext.invoke (dummyButton.getUI(), new Object[] {dummyButton});
    } else {
      throw new IllegalStateException ("I don't have a SynthButtonUI to play with"); //NOI18N
    }
  } catch (Exception e) {
    functioning = Boolean.FALSE;
    if (log) {
      e.printStackTrace();
    }
    return null;
  }
}

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

private static void fixToolbarButtonImpl(JButton button)
    throws Exception {
  ButtonUI ui = button.getUI();
  String clazzName = ui.getClass().getName();
  if (BUTTON_UI_CLASS_NAME.equals(clazzName)) {
    Class<?> uiClazz = ui.getClass();
    Method m = uiClazz.getDeclaredMethod("setRolloverDecoratedOnly",
        boolean.class);
    m.invoke(ui, true);
    m = uiClazz.getMethod("setRound", int.class);
    ClassLoader cl = uiClazz.getClassLoader();
    Class<?> clazz = Class.forName(STYLE_CONSTANTS_CLASS, true, cl);
    Field smallRound = clazz.getField("smallRound");
    int value = smallRound.getInt(null);
    m.invoke(ui, value);
    // By default, buttons have 4 pixel spacing on their left and
    // right, which looks ridiculous for tool bar buttons.  WebLaF
    // provides factory methods for icon-only buttons to work around
    // this, but we are avoiding WebLaF-specific APIs.
    m = uiClazz.getMethod("setLeftRightSpacing", int.class);
    m.invoke(ui, 0);
  }
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public CabecalhoAba(Aba aba)
{
  initComponents();
  this.aba = aba;
  if(WeblafUtils.weblafEstaInstalado()){
    ((WebButtonUI)botaoFechar.getUI()).setUndecorated(true);
  }
  configurarCores();
  configuraIcones();
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Returns the scroll button state.
 * 
 * @param scrollButton
 *            Scroll button.
 * @return Scroll button state.
 */
protected ComponentState getState(JButton scrollButton) {
  if (scrollButton == null)
    return null;
  ComponentState result = ((TransitionAwareUI) scrollButton.getUI())
      .getTransitionTracker().getModelStateInfo().getCurrModelState();
  if ((result == ComponentState.ENABLED)
      && SubstanceCoreUtilities.hasFlatAppearance(this.scrollbar,
          false)) {
    result = null;
  }
  if (SubstanceCoreUtilities.isButtonNeverPainted(scrollButton)) {
    result = null;
  }
  return result;
}

代码示例来源:origin: org.java.net.substance/substance

/**
 * Returns the scroll button state.
 * 
 * @param scrollButton
 *            Scroll button.
 * @return Scroll button state.
 */
protected ComponentState getState(JButton scrollButton) {
  if (scrollButton == null)
    return null;
  ComponentState result = ((TransitionAwareUI) scrollButton.getUI())
      .getTransitionTracker().getModelStateInfo().getCurrModelState();
  if ((result == ComponentState.ENABLED)
      && SubstanceCoreUtilities.hasFlatAppearance(this.scrollbar,
          false)) {
    result = null;
  }
  if (SubstanceCoreUtilities.isButtonNeverPainted(scrollButton)) {
    result = null;
  }
  return result;
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

final int defaultBtnWidth = removeButton.getUI().getPreferredSize(backButton).width;
addComponentListener(new ComponentAdapter() {
  private final int[] empty = {};

相关文章

JButton类方法