javax.swing.JToolBar.createActionComponent()方法的使用及代码示例

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

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

JToolBar.createActionComponent介绍

暂无

代码示例

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

protected JButton createActionComponent(Action a) {
  JButton b = super.createActionComponent(a);
  if (buttonStyle == BUTTON_STYLE_VERICAL) {
    b.putClientProperty("hideActionText", Boolean.FALSE); //NOI18N
    String iconBase = (String) a.getValue("iconBase"); //NOI18N
    if (iconBase != null) {
      try {
        System.err.println("URL for: " + insertBeforeSuffix(iconBase, "32")); //NOI18N
        URL url = a.getClass().getResource(insertBeforeSuffix(iconBase, "32")); //NOI18N
        System.err.println("is: " + url); //NOI18N
        b.setIcon(new ImageIcon(url));
      } catch (Exception e) {
        e.printStackTrace(System.err);
      }
    }
  }
  return b;
}

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

@Override
protected JButton createActionComponent(Action a) {
  JButton b = super.createActionComponent(a);
  if (buttonStyle == BUTTON_STYLE_VERICAL) {
    b.putClientProperty("hideActionText", Boolean.FALSE); //NOI18N
    String iconBase = (String) a.getValue("iconBase"); //NOI18N
    if (iconBase != null) {
      try {
        System.err.println("URL for: " + insertBeforeSuffix(iconBase, "32")); //NOI18N
        URL url = a.getClass().getResource(insertBeforeSuffix(iconBase, "32")); //NOI18N
        System.err.println("is: " + url); //NOI18N
        b.setIcon(new ImageIcon(url));
      } catch (Exception e) {
        e.printStackTrace(System.err);
      }
    }
  }
  return b;
}

代码示例来源:origin: org.terracotta.modules/tim-ehcache-2.x-ui

@Override
 protected JButton createActionComponent(Action a) {
  JButton b = super.createActionComponent(a);
  b.setHorizontalTextPosition(SwingConstants.TRAILING);
  b.setVerticalTextPosition(SwingConstants.CENTER);
  b.putClientProperty("hideActionText", Boolean.FALSE);
  Class<?> bClass = b.getClass();
  for (Field field : bClass.getDeclaredFields()) {
   if (field.getName().equals("hideActionText")) {
    try {
     field.setAccessible(true);
     field.setBoolean(b, false);
    } catch (Exception e) {/**/
    }
   }
  }
  return b;
 }
}

代码示例来源:origin: org.terracotta.modules/tim-quartz-ui

@Override
 protected JButton createActionComponent(Action a) {
  JButton b = super.createActionComponent(a);
  b.setHorizontalTextPosition(SwingConstants.TRAILING);
  b.setVerticalTextPosition(SwingConstants.CENTER);
  b.putClientProperty("hideActionText", Boolean.FALSE);
  Class<?> bClass = b.getClass();
  for (Field field : bClass.getDeclaredFields()) {
   if (field.getName().equals("hideActionText")) {
    try {
     field.setAccessible(true);
     field.setBoolean(b, false);
    } catch (Exception e) {/**/
    }
   }
  }
  return b;
 }
}

相关文章

JToolBar类方法