javax.swing.JMenuItem.getComponentOrientation()方法的使用及代码示例

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

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

JMenuItem.getComponentOrientation介绍

暂无

代码示例

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

if (menuItem.getComponentOrientation().isLeftToRight()) {
  textRect.x += menuItemGap;
  iconRect.x += menuItemGap;

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

int defaultTextIconGap = UIDefaultsLookup.getInt("MenuItem.textIconGap");
  int defaultShadowWidth = UIDefaultsLookup.getInt("MenuItem.shadowWidth");
  if (menuItem.getComponentOrientation().isLeftToRight()) {
    textRect.x = defaultShadowWidth + defaultTextIconGap;
else if (!menuItem.getComponentOrientation().isLeftToRight()) {
  if (menuItem.getComponentOrientation().isHorizontal()) {
    Rectangle2D rectText = fm.getStringBounds(text, g);
    textRect.x = (int) (menuItem.getWidth() - textRect.x - rectText.getWidth() + (4 + menuItem.getHeight() / 2 - 1));

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

if (menuItem.getComponentOrientation().isLeftToRight()) {
  textRect.x += menuItemGap;
  iconRect.x += menuItemGap;

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

if (!b.getComponentOrientation().isLeftToRight()) {
  if (b.getComponentOrientation().isHorizontal()) {
    iconRect.x = b.getWidth() - iconRect.x - icon.getIconWidth() + ( 4 + b.getHeight() / 2 - 1);

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

if (menuItem.getComponentOrientation().isLeftToRight()) {
  int defaultTextIconGap = UIDefaultsLookup.getInt("MenuItem.textIconGap");
  int defaultShadowWidth = UIDefaultsLookup.getInt("MenuItem.shadowWidth");

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

if (menuItem.getComponentOrientation().isLeftToRight()) {
  if (getRightMargin() == 0) {
    textRect.x += menuItemGap;

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

if (menuItem.getComponentOrientation().isLeftToRight()) {
  if (menuItem.getBackground() instanceof UIResource) {
    g.setColor(getPainter().getMenuItemBackground());

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

if (menuItem.getComponentOrientation().isLeftToRight()) {
  int defaultTextIconGap = UIDefaultsLookup.getInt("MenuItem.textIconGap");
  int defaultShadowWidth = UIDefaultsLookup.getInt("MenuItem.shadowWidth");

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

if ((useCheckAndArrow() || menuItem instanceof JideSplitButton) && !menuItem.getComponentOrientation().isLeftToRight()) {
  checkIconRect.x = viewRect.width - checkIconRect.width - checkIconRect.x;
  iconRect.x = viewRect.width - iconRect.width - iconRect.x;

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

if (menuItem.getComponentOrientation().isLeftToRight()) {

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

&& (gutterFillKind != MenuGutterFillKind.NONE);
int gap = popupMetrics.maxIconTextGap;
if (menuItem.getComponentOrientation().isLeftToRight()) {
  int currX = i.left + gap / 2;
  if (checkIcon != null) {

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

&& (gutterFillKind != MenuGutterFillKind.NONE);
int gap = popupMetrics.maxIconTextGap;
if (menuItem.getComponentOrientation().isLeftToRight()) {
  int currX = i.left + gap / 2;
  if (checkIcon != null) {

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

protected void paintArrow(JMenuItem menuItem, Graphics g) {
  int menuWidth;
  int menuHeight;
  int orientation = JideSwingUtilities.getOrientationOf(menuItem);
  if (orientation == SwingConstants.HORIZONTAL) {
    menuWidth = menuItem.getWidth();
    menuHeight = menuItem.getHeight();
  }
  else {
    menuWidth = menuItem.getHeight();
    menuHeight = menuItem.getWidth();
  }
  int startX;
  if (menuItem.getComponentOrientation().isLeftToRight()) {
    startX = menuWidth - 9;
  }
  else {
    startX = 4;
  }
  if (menuItem.isEnabled()) {
    JideSwingUtilities.paintArrow(g, getForegroundOfState(menuItem), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
  }
  else {
    JideSwingUtilities.paintArrow(g, UIDefaultsLookup.getColor("controlShadow"), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
  }
}

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

protected void paintArrow(JMenuItem menuItem, Graphics g) {
  int menuWidth;
  int menuHeight;
  int orientation = JideSwingUtilities.getOrientationOf(menuItem);
  if (orientation == SwingConstants.HORIZONTAL) {
    menuWidth = menuItem.getWidth();
    menuHeight = menuItem.getHeight();
  }
  else {
    menuWidth = menuItem.getHeight();
    menuHeight = menuItem.getWidth();
  }
  int startX;
  if (menuItem.getComponentOrientation().isLeftToRight()) {
    startX = menuWidth - 9;
  }
  else {
    startX = 4;
  }
  if (menuItem.isEnabled()) {
    JideSwingUtilities.paintArrow(g, getForegroundOfState(menuItem), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
  }
  else {
    JideSwingUtilities.paintArrow(g, UIDefaultsLookup.getColor("controlShadow"), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
  }
}

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

protected void paintArrow(JMenuItem menuItem, Graphics g) {
  int menuWidth;
  int menuHeight;
  int orientation = JideSwingUtilities.getOrientationOf(menuItem);
  if (orientation == SwingConstants.HORIZONTAL) {
    menuWidth = menuItem.getWidth();
    menuHeight = menuItem.getHeight();
  }
  else {
    menuWidth = menuItem.getHeight();
    menuHeight = menuItem.getWidth();
  }
  int startX;
  if (menuItem.getComponentOrientation().isLeftToRight()) {
    startX = menuWidth - 9;
  }
  else {
    startX = 4;
  }
  if (menuItem.isEnabled()) {
    JideSwingUtilities.paintArrow(g, getForegroundOfState(menuItem), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
  }
  else {
    JideSwingUtilities.paintArrow(g, UIDefaultsLookup.getColor("controlShadow"), startX, menuHeight / 2 - 1, 5, SwingConstants.HORIZONTAL);
  }
}

相关文章

JMenuItem类方法