javax.swing.JMenu.isTopLevelMenu()方法的使用及代码示例

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

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

JMenu.isTopLevelMenu介绍

暂无

代码示例

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

private static boolean useCheckAndArrow(JMenuItem menuItem) {
  boolean b = true;
  if ((menuItem instanceof JMenu)
      && (((JMenu) menuItem).isTopLevelMenu())) {
    b = false;
  }
  return b;
}

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

private boolean useCheckAndArrow() {
  boolean b = true;
  if ((menuItem instanceof JMenu) &&
      (((JMenu) menuItem).isTopLevelMenu())) {
    b = false;
  }
  return b;
}

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

protected boolean useCheckAndArrow() {
  boolean b = true;
  if ((menuItem instanceof JMenu) &&
      (((JMenu) menuItem).isTopLevelMenu())) {
    b = false;
  }
  return b;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

private boolean useCheckAndArrow()
{
  boolean b= true;
  if ((menuItem instanceof JMenu) && (((JMenu) menuItem).isTopLevelMenu()))
  {
    b= false;
  }
  return b;
}

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

private static boolean useCheckAndArrow(JMenuItem menuItem) {
  boolean b = true;
  if ((menuItem instanceof JMenu)
      && (((JMenu) menuItem).isTopLevelMenu())) {
    b = false;
  }
  return b;
}

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

private boolean useCheckAndArrow() {
  boolean b = true;
  if ((menuItem instanceof JMenu) &&
      (((JMenu) menuItem).isTopLevelMenu())) {
    b = false;
  }
  return b;
}

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

private boolean isTopLevelMenu(Component item) {
  return (item instanceof JMenu) && ((JMenu)item).isTopLevelMenu();
}

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

private boolean isTopLevelMenu() {
  return (menuItem instanceof JMenu) && ((JMenu)menuItem).isTopLevelMenu();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**	Returns the maximum size for the specified component */
public Dimension getMaximumSize(JComponent c)
{
  if (((JMenu) menuItem).isTopLevelMenu() == true)
  {
    Dimension d= c.getPreferredSize();
    return new Dimension(d.width, Short.MAX_VALUE);
  }
  return null;
}

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

public Dimension getMaximumSize(JComponent c) {
  if(((JMenu)menuItem).isTopLevelMenu()) {
    Dimension d = c.getPreferredSize();
    return new Dimension(d.width, Short.MAX_VALUE);
  }
  
  return null;
}

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

@Override
public Dimension getMaximumSize(JComponent c) {
  if (((JMenu) menuItem).isTopLevelMenu() == true) {
    Dimension d = c.getPreferredSize();
    return new Dimension(d.width, Short.MAX_VALUE);
  }
  return null;
}

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

@Override
public Dimension getMaximumSize(JComponent c) {
  if (((JMenu) menuItem).isTopLevelMenu() == true) {
    Dimension d = c.getPreferredSize();
    return new Dimension(d.width, Short.MAX_VALUE);
  }
  return null;
}

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

@Override
public Dimension getMaximumSize(JComponent c) {
  if (menuItem instanceof JMenu && ((JMenu) menuItem).isTopLevelMenu()) {
    Dimension d = c.getPreferredSize();
    if (JideSwingUtilities.getOrientationOf(menuItem) == SwingConstants.HORIZONTAL) {
      return new Dimension(d.width, Short.MAX_VALUE);
    }
    else {
      return new Dimension(Short.MAX_VALUE, d.height);
    }
  }
  return null;
}

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

public void mouseExited(MouseEvent e) {
  JMenu menu = (JMenu) menuItem;
  
  if(!menu.isEnabled() || systemMenuShowing ||
    menu.getClientProperty("isSystemMenu") == Boolean.TRUE)
  {
    return;
  }
  
  menu.putClientProperty("rollover", Boolean.FALSE);
  
  if(menu.isTopLevelMenu()) {
    menu.repaint();
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void mouseEntered(MouseEvent evt) {
  super.mouseEntered(evt);
  JMenu menu = (JMenu) evt.getSource();
  if (menu.isTopLevelMenu() && menu.isRolloverEnabled()) {
    menu.getModel().setRollover(true);
    menuItem.repaint();
  }
}

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

@Override
public Dimension getPreferredSize(JComponent c) {
  Dimension size = super.getPreferredSize(c);
  if (menuItem instanceof JMenu && ((JMenu) menuItem).isTopLevelMenu() &&
      isDownArrowVisible(menuItem.getParent())) {
    if (JideSwingUtilities.getOrientationOf(menuItem) == SwingConstants.HORIZONTAL)
      size.width += 11;
    else
      size.height += 11;
  }
  return size;
}

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

@Override
  public Dimension getPreferredSize(JComponent c) {
    Dimension size = super.getPreferredSize(c);
    if (menuItem instanceof JMenu && ((JMenu) menuItem).isTopLevelMenu() &&
        isDownArrowVisible(menuItem.getParent())) {
      if (JideSwingUtilities.getOrientationOf(menuItem) == SwingConstants.HORIZONTAL)
        size.width += 11;
      else
        size.height += 11;
    }
    return size;
  }
}

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

@Override
  public Dimension getPreferredSize(JComponent c) {
    Dimension size = super.getPreferredSize(c);
    if (menuItem instanceof JMenu && ((JMenu) menuItem).isTopLevelMenu() &&
        isDownArrowVisible(menuItem.getParent())) {
      if (JideSwingUtilities.getOrientationOf(menuItem) == SwingConstants.HORIZONTAL)
        size.width += 11;
      else
        size.height += 11;
    }
    return size;
  }
}

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

private void updateDefaultBackgroundColor() {
  if (!UIDefaultsLookup.getBoolean("Menu.useMenuBarBackgroundForTopLevel")) {
    return;
  }
  JMenu menu = (JMenu) menuItem;
  if (menu.getBackground() instanceof UIResource) {
    if (menu.isTopLevelMenu()) {
      menu.setBackground(UIDefaultsLookup.getColor("MenuBar.background"));
    }
    else {
      menu.setBackground(UIDefaultsLookup.getColor(getPropertyPrefix() + ".background"));
    }
  }
}

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

@Override
public Dimension getMaximumSize(JComponent c) {
  if (!(c instanceof JMenu) || !((JMenu) c).isTopLevelMenu()) {
    return super.getMaximumSize(c);
  }
  Dimension d = getPreferredSize(c);
  View v = (View) c.getClientProperty(BasicHTML.propertyKey);
  if (v != null) {
    if (JideSwingUtilities.getOrientationOf(c) == SwingConstants.HORIZONTAL)
      d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
    else        // TODO: not sure if this is correct
      d.height += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
  }
  return d;
}

相关文章