javax.swing.JPopupMenu.applyComponentOrientation()方法的使用及代码示例

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

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

JPopupMenu.applyComponentOrientation介绍

暂无

代码示例

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Returns the popup menu for this component, lazily creating it if
 * necessary.
 *
 * @return The popup menu.
 * @see #createPopupMenu()
 * @see #setPopupMenu(JPopupMenu)
 */
public JPopupMenu getPopupMenu() {
  if (!popupMenuCreated) {
    popupMenu = createPopupMenu();
    if (popupMenu!=null) {
      ComponentOrientation orientation = ComponentOrientation.
                  getOrientation(Locale.getDefault());
      popupMenu.applyComponentOrientation(orientation);
    }
    popupMenuCreated = true;
  }
  return popupMenu;
}

代码示例来源:origin: ron190/jsql-injection

@Override
  public void mousePressed(MouseEvent e) {
    popup.applyComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));
    if (ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT) {
      radioCustomMethod.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 6));
    } else {
      radioCustomMethod.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
    }
    
    popup.show(
      e.getComponent(),
      ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
      ? e.getComponent().getX() - e.getComponent().getWidth() - popup.getWidth()
      : e.getComponent().getX(),
      e.getComponent().getY() + e.getComponent().getWidth()
    );
    
    popup.setLocation(
      ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
      ? e.getComponent().getLocationOnScreen().x + e.getComponent().getWidth() - popup.getWidth()
      : e.getComponent().getLocationOnScreen().x,
      e.getComponent().getLocationOnScreen().y + e.getComponent().getWidth()
    );
  }
});

代码示例来源:origin: ron190/jsql-injection

popupMenuList.add(mnRestoreDefault);
popupMenuList.applyComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));

代码示例来源:origin: ron190/jsql-injection

menu.add(itemSelectAll);
menu.applyComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/** 
 * @inheritDoc
 * 
 */
@Override
public void applyComponentOrientation(ComponentOrientation o) {
  getPopupMenu().applyComponentOrientation(o);
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/** 
 * @inheritDoc
 * 
 */
@Override
public void applyComponentOrientation(ComponentOrientation o) {
  getPopupMenu().applyComponentOrientation(o);
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/** 
 * @inheritDoc
 * 
 */
@Override
public void applyComponentOrientation(ComponentOrientation o) {
  getPopupMenu().applyComponentOrientation(o);
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/** 
 * @inheritDoc
 * 
 */
@Override
public void applyComponentOrientation(ComponentOrientation o) {
  getPopupMenu().applyComponentOrientation(o);
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/** 
 * @inheritDoc
 * 
 */
public void applyComponentOrientation(ComponentOrientation o) {
  getPopupMenu().applyComponentOrientation(o);
}

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

/**
 * Overridden to apply the new orientation to our (possibly hidden)
 * child components.
 *
 * @param o The new component orientation.
 */
@Override
public void applyComponentOrientation(ComponentOrientation o) {
  super.applyComponentOrientation(o);
  for (Component c : children) {
    c.applyComponentOrientation(o);
  }
}

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

/**
 * Overridden to apply the new orientation to our (possibly hidden)
 * child components.
 *
 * @param o The new component orientation.
 */
public void applyComponentOrientation(ComponentOrientation o) {
  super.applyComponentOrientation(o);
  for (Iterator i=children.iterator(); i.hasNext(); ) {
    Component c = (Component)i.next();
    c.applyComponentOrientation(o);
  }
}

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

/**
 * Sets the orientation of this component.  This is overridden to also
 * update the orientation of the popup menu.
 *
 * @param o The new orientation.
 */
@Override
public void applyComponentOrientation(ComponentOrientation o) {
  super.applyComponentOrientation(o);
  if (popupMenu!=null) {
    popupMenu.applyComponentOrientation(o);
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

/**
 * Overridden to apply the new orientation to our (possibly hidden) child
 * components.
 *
 * @param o The new component orientation.
 */
public void applyComponentOrientation(ComponentOrientation o) {
  super.applyComponentOrientation(o);
  for (Iterator i = children.iterator(); i.hasNext();) {
    Component c = (Component) i.next();
    c.applyComponentOrientation(o);
  }
}

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

/**
 * Returns the popup menu for this component, lazily creating it if
 * necessary.
 *
 * @return The popup menu.
 * @see #createPopupMenu()
 * @see #setPopupMenu(JPopupMenu)
 */
public JPopupMenu getPopupMenu() {
  if (!popupMenuCreated) {
    popupMenu = createPopupMenu();
    if (popupMenu!=null) {
      ComponentOrientation orientation = ComponentOrientation.
                  getOrientation(Locale.getDefault());
      popupMenu.applyComponentOrientation(orientation);
    }
    popupMenuCreated = true;
  }
  return popupMenu;
}

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

/**
 * Returns the popup menu for this component, lazily creating it if
 * necessary.
 *
 * @return The popup menu.
 * @see #createPopupMenu()
 * @see #setPopupMenu(JPopupMenu)
 */
public JPopupMenu getPopupMenu() {
  if (!popupMenuCreated) {
    popupMenu = createPopupMenu();
    if (popupMenu!=null) {
      ComponentOrientation orientation = ComponentOrientation.
                  getOrientation(Locale.getDefault());
      popupMenu.applyComponentOrientation(orientation);
    }
    popupMenuCreated = true;
  }
  return popupMenu;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

/**
 * Returns the popup menu for this component, lazily creating it if
 * necessary.
 *
 * @return The popup menu.
 * @see #createPopupMenu()
 * @see #setPopupMenu(JPopupMenu)
 */
public JPopupMenu getPopupMenu() {
  if (!popupMenuCreated) {
    popupMenu = createPopupMenu();
    if (popupMenu!=null) {
      ComponentOrientation orientation = ComponentOrientation.
                  getOrientation(Locale.getDefault());
      popupMenu.applyComponentOrientation(orientation);
    }
    popupMenuCreated = true;
  }
  return popupMenu;
}

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

@Override
public void actionPerformed(ActionEvent e) {
  Point location = getLocation();
  location.y = getHeight();
  popupMenu.applyComponentOrientation(
        MenuButton.this.getComponentOrientation());
  popupMenu.show(MenuButton.this, 0,location.y);
}

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

/**
 * Sets up vertical scrollbar's popup menu.
 */
private void createVerticalScrollBarMenu() {
  vertSBMenu = new JPopupMenu();
  ResourceBundle msg = ResourceBundle.getBundle(RScrollPane.class.getName());
  addMenuItem("ScrollHere","ScrollHereVertical", vertSBMenu, msg);
  vertSBMenu.addSeparator();
  addMenuItem("Top", "Top", vertSBMenu, msg);
  addMenuItem("Bottom", "Bottom", vertSBMenu, msg);
  vertSBMenu.addSeparator();
  addMenuItem("PageUp", "PageUp", vertSBMenu, msg);
  addMenuItem("PageDown", "PageDown", vertSBMenu, msg);
  vertSBMenu.addSeparator();
  addMenuItem("ScrollUp", "ScrollUp", vertSBMenu, msg);
  addMenuItem("ScrollDown", "ScrollDown", vertSBMenu, msg);
  vertSBMenu.applyComponentOrientation(getComponentOrientation());
}

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

/**
   * Shows the popup menu with the consideration of the invoker's orientation.
   *
   * @param popup   the popup menu
   * @param invoker the invoker for the popup menu
   * @param x       the x, usually the x of the mouse clicked position
   * @param y       the y, usually the y of the mouse clicked position
   */
  public static void showPopupMenu(JPopupMenu popup, Component invoker, int x, int y) {
    popup.applyComponentOrientation(invoker.getComponentOrientation());
    if (popup.getComponentOrientation().isLeftToRight()) {
      popup.show(invoker, x, y);
    }
    else {
      popup.show(invoker, x - popup.getPreferredSize().width, y);
    }

  }
}

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

/**
 * Sets up horizontal scrollbar's popup menu.
 */
private void createHorizontalScrollBarMenu() {
  horizSBMenu = new JPopupMenu();
  ResourceBundle msg = ResourceBundle.getBundle(RScrollPane.class.getName());
  addMenuItem("ScrollHere", "ScrollHereHorizontal", horizSBMenu, msg);
  horizSBMenu.addSeparator();
  addMenuItem("LeftEdge", "LeftEdge", horizSBMenu, msg);
  addMenuItem("RightEdge", "RightEdge", horizSBMenu, msg);
  horizSBMenu.addSeparator();
  addMenuItem("PageLeft", "PageLeft", horizSBMenu, msg);
  addMenuItem("PageRight", "PageRight", horizSBMenu, msg);
  horizSBMenu.addSeparator();
  addMenuItem("ScrollLeft","ScrollLeft",horizSBMenu, msg);
  addMenuItem("ScrollRight", "ScrollRight", horizSBMenu, msg);
  horizSBMenu.applyComponentOrientation(getComponentOrientation());
}

相关文章

JPopupMenu类方法