本文整理了Java中javax.swing.JPopupMenu.getComponentIndex()
方法的一些代码示例,展示了JPopupMenu.getComponentIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPopupMenu.getComponentIndex()
方法的具体详情如下:
包路径:javax.swing.JPopupMenu
类名称:JPopupMenu
方法名:getComponentIndex
暂无
代码示例来源:origin: MegaMek/megamek
/**
* Scrolls the specified item into view each time the menu is opened. Call this method with
* <code>null</code> to restore the default behavior, which is to show the menu as it last
* appeared.
*
* @param item the item to keep visible
* @see #keepVisible(int)
*/
public void keepVisible(JMenuItem item) {
if (item == null) {
keepVisibleIndex = -1;
} else {
int index = menu.getComponentIndex(item);
keepVisibleIndex = index;
}
}
代码示例来源:origin: GoldenGnu/jeveassets
/**
* Scrolls the specified item into view each time the menu is opened. Call
* this method with
* <code>null</code> to restore the default behavior, which is to show the
* menu as it last appeared.
*
* @param item the item to keep visible
* @see #keepVisible(int)
*/
public void keepVisible(final JMenuItem item) {
if (item == null) {
keepVisibleIndex = -1;
} else {
int index = menu.getComponentIndex(item);
keepVisibleIndex = index;
}
}
代码示例来源:origin: org.apache.jmeter/jorphan
/**
* Scrolls the specified item into view each time the menu is opened. Call
* this method with <code>null</code> to restore the default behavior, which
* is to show the menu as it last appeared.
*
* @param item
* the item to keep visible
* @see #keepVisible(int)
*/
public void keepVisible(JMenuItem item) {
if (item == null) {
keepVisibleIndex = -1;
} else {
int index = menu.getComponentIndex(item);
keepVisibleIndex = index;
}
}
代码示例来源:origin: stackoverflow.com
class MenuActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
JMenuItem menuitem=(JMenuItem) e.getSource();
JPopupMenu popupMenu =(JPopupMenu) menuitem.getParent();
int index= popupMenu.getComponentIndex(menuitem);
System.out.println("index:"+index);
}
}
代码示例来源:origin: org.cytoscape/swing-util-api
@Override
public void removeComponent(final Component component) {
if (componentGravity.remove(component) != null)
menu.remove(menu.getComponentIndex(component));
}
内容来源于网络,如有侵权,请联系作者删除!