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

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

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

JMenu.getParent介绍

暂无

代码示例

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

/**
 * Returns the original invoking component, taking into account
 * nested popup menus.
 *
 * @param source The source component (a JMenuItem).
 * @return The original invoking component of the action.
 */
protected JComponent getOriginalInvoker(Container source) {
  JPopupMenu popup = (JPopupMenu)source.getParent();
  JComponent invoker = (JComponent)popup.getInvoker();
  while (invoker instanceof JMenu) { // Just a nested menu
    popup = (JPopupMenu)((JMenu)invoker).getParent();
    invoker = (JComponent)popup.getInvoker();
  }
  return invoker;
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setLeft(int aValue) {
  if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
    MarginLayout.ajustLeft(this, aValue);
  }
  super.setLocation(aValue, getTop());
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setTop(int aValue) {
  if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
    MarginLayout.ajustTop(this, aValue);
  }
  super.setLocation(getLeft(), aValue);
}

代码示例来源:origin: de.sciss/syntaxpane

stack = sub;
} else if (menuString.startsWith("<")) {
  Container parent = stack == null ? null : stack.getParent();
  if (parent instanceof JMenu) {
    stack = (JMenu) parent;

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(name = "parent", jsDoc = PARENT_JSDOC)
@Override
public Widget getParentWidget() {
  java.awt.Container parent = super.getParent();
  if (parent instanceof JPopupMenu && ((JPopupMenu) parent).getInvoker() instanceof JMenu) {
    parent = (java.awt.Container) ((JPopupMenu) parent).getInvoker();
  }
  return parent instanceof HasChildren ? (Widget) parent : null;
}

代码示例来源:origin: de.sciss/submin

@Override
  protected void paintBackground(Graphics2D g2d, boolean selected) {
    if (component.getParent() instanceof JPopupMenu) {
//            super.paintBackground ( g2d, selected );
      if (selected) {
        g2d.setPaint(new GradientPaint(0, 0, selectedTopBg, 0, component.getHeight(), selectedBottomBg));
        g2d.fillRect(0, 0, component.getWidth(), component.getHeight());
      }
    } else {
      if (component.isEnabled() && (selected || mouseover)) {
//                LafUtils.drawWebStyle ( g2d, component, shadeColor, shadeWidth, round, component.isEnabled (),
//                        !selected && mouseover, selected ? StyleConstants.averageBorderColor : StyleConstants.borderColor );
        // final Color borderColor = selected ? StyleConstants.averageBorderColor : StyleConstants.borderColor;
//                final float opacity = mouseover ? getHoverOpacity () : 1f;
        final float opacity = selected ? 1f : getHoverOpacity();
        final Paint bgPaint = new GradientPaint(0, 0, selectedTopBg, 0, component.getHeight(), selectedBottomBg);
        drawShape(g2d, component, shadeColor, shadeWidth, round, component.isEnabled(),
            borderColor, borderColor, bgPaint, opacity);
      }
    }
  }

代码示例来源:origin: eu.mihosoft.vrl/vrl

m.getParent().remove(m);

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

Container c=_menu.getParent();
c.remove(_menu);

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

public void actionPerformed(ActionEvent e) {
  if (!crossMenuMnemonic) {
    JPopupMenu pm = getActivePopupMenu();
    if (pm != null && pm != menu.getParent()) {
      return;
    Container cnt = menu.getParent();
    if (cnt != null && cnt instanceof JMenuBar) {
      MenuElement me[];

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

public void actionPerformed(ActionEvent e) {
  if (!crossMenuMnemonic) {
    JPopupMenu pm = getActivePopupMenu();
    if (pm != null && pm != menu.getParent()) {
      return;
    Container cnt = menu.getParent();
    if (cnt != null && cnt instanceof JMenuBar) {
      MenuElement me[];

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

public void actionPerformed(ActionEvent e) {
  if (!crossMenuMnemonic) {
    JPopupMenu pm = getActivePopupMenu();
    if (pm != null && pm != menu.getParent()) {
      return;
    Container cnt = menu.getParent();
    if (cnt != null && cnt instanceof JMenuBar) {
      MenuElement me[];

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

selectedPath[0] == menu.getParent()) {
 MenuElement newPath[] = new MenuElement[3];
 newPath[0] = (MenuElement)menu.getParent();
 newPath[1] = menu;
 newPath[2] = menu.getPopupMenu();

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

public void actionPerformed(ActionEvent e) {
   final MenuSelectionManager defaultManager = MenuSelectionManager.defaultManager();
      if(force) {
         Container cnt = menu.getParent();
         if(cnt != null && cnt instanceof JMenuBar) {
           MenuElement me[];
           MenuElement subElements[];
    
           subElements = menu.getPopupMenu().getSubElements();
           if(subElements.length > 0) {
              me = new MenuElement[4];
              me[0] = (MenuElement) cnt;
              me[1] = (MenuElement) menu;
              me[2] = (MenuElement) menu.getPopupMenu();
              me[3] = subElements[0];
           } else {
              me = new MenuElement[3];
              me[0] = (MenuElement)cnt;
              me[1] = menu;
              me[2] = (MenuElement) menu.getPopupMenu();
           }
           defaultManager.setSelectedPath(me);
  }
      } else {
         MenuElement path[] = defaultManager.getSelectedPath();
         if(path.length > 0 && path[path.length-1] == menu) {
           appendPath(path, menu.getPopupMenu());
         }
      }
   }

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

@Test
public void createsSubmenuWithoutAction() {
  Entry parentMenuEntry = new Entry();
  final JMenu parentMenu = new JMenu();
  new EntryAccessor().setComponent(parentMenuEntry, parentMenu);
  parentMenuEntry.addChild(menuEntry);
  menuEntry.addChild(actionEntry);
  
  menuActionGroupBuilder.visit(menuEntry);
  JMenu item = (JMenu)new EntryAccessor().getComponent(menuEntry);
  assertThat(item.getParent(), CoreMatchers.<Container>equalTo(parentMenu.getPopupMenu()));
}

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

selectedPath[0] == menu.getParent()) {
MenuElement newPath[] = new MenuElement[3];
newPath[0] = (MenuElement) menu.getParent();
newPath[1] = menu;
newPath[2] = menu.getPopupMenu();

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

selectedPath[0] == menu.getParent()) {
MenuElement newPath[] = new MenuElement[3];
newPath[0] = (MenuElement) menu.getParent();
newPath[1] = menu;
newPath[2] = menu.getPopupMenu();

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

selectedPath[0] == menu.getParent()) {
MenuElement newPath[] = new MenuElement[3];
newPath[0] = (MenuElement) menu.getParent();
newPath[1] = menu;
newPath[2] = menu.getPopupMenu();

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

selectedPath[0] == menu.getParent()) {
MenuElement newPath[] = new MenuElement[3];
newPath[0] = (MenuElement) menu.getParent();
newPath[1] = menu;
newPath[2] = menu.getPopupMenu();

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

@Test
public void createsMainMenuWithoutAction() {
  Entry parentMenuEntry = new Entry();
  final FreeplaneMenuBar parentMenu = TestMenuBarFactory.createFreeplaneMenuBar();
  new EntryAccessor().setComponent(parentMenuEntry, parentMenu);
  parentMenuEntry.addChild(menuEntry);
  menuEntry.addChild(actionEntry);
  
  menuActionGroupBuilder.visit(menuEntry);
  JMenu item = (JMenu)new EntryAccessor().getComponent(menuEntry);
  assertThat(item.getParent(), CoreMatchers.<Container>equalTo(parentMenu));
}

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

manager.clearSelectedPath();
} else {
   Container cnt = menu.getParent();
   if(cnt != null && cnt instanceof JMenuBar) {
  MenuElement me[] = new MenuElement[2];

相关文章