本文整理汇总了Java中javax.swing.JPopupMenu.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java JPopupMenu.setFocusable方法的具体用法?Java JPopupMenu.setFocusable怎么用?Java JPopupMenu.setFocusable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JPopupMenu
的用法示例。
在下文中一共展示了JPopupMenu.setFocusable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeShowPopup
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setFocusable(false);
popupMenu.add(jMenuItemUndo);
popupMenu.add(jMenuItemRedo);
popupMenu.addSeparator();
popupMenu.add(jMenuItemCut);
popupMenu.add(jMenuItemCopy);
popupMenu.add(jMenuItemPaste);
popupMenu.addSeparator();
if (jMenuItemInsCell.getAction().isEnabled()) {
popupMenu.add(jMenuItemInsCell);
jMenuItemInsCell.setEnabled(true);
popupMenu.add(jMenuItemInsRow);
jMenuItemInsRow.setEnabled(true);
popupMenu.addSeparator();
}
popupMenu.add(jMenuItemProp);
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
示例2: maybeShowPopup
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setFocusable(false);
popupMenu.add(jMenuItemUndo);
popupMenu.add(jMenuItemRedo);
popupMenu.addSeparator();
popupMenu.add(jMenuItemCut);
popupMenu.add(jMenuItemCopy);
popupMenu.add(jMenuItemPaste);
popupMenu.addSeparator();
if (jMenuItemInsCell.getAction().isEnabled()) {
popupMenu.add(jMenuItemInsCell);
jMenuItemInsCell.setEnabled(true);
popupMenu.add(jMenuItemInsRow);
jMenuItemInsRow.setEnabled(true);
popupMenu.addSeparator();
}
popupMenu.add(jMenuItemProp);
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
示例3: createPopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/**
* Creates a popup menu for the resource tree.
* @param node tree node that the mouse is over
*/
JPopupMenu createPopupMenu(TreeNode node) {
JPopupMenu res = new JPopupMenu();
res.setFocusable(false);
res.add(getActions().getNewAction(getResourceKind()));
if (node instanceof ResourceTreeNode) {
res.add(getActions().getEditAction(getResourceKind()));
res.addSeparator();
res.add(getActions().getCopyAction(getResourceKind()));
res.add(getActions().getDeleteAction(getResourceKind()));
res.add(getActions().getRenameAction(getResourceKind()));
if (getResourceKind().isEnableable()) {
res.addSeparator();
res.add(getActions().getEnableAction(getResourceKind()));
}
}
return res;
}
示例4: maybeShowPopup
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setFocusable(false);
popupMenu.add(jMenuItemUndo);
popupMenu.add(jMenuItemRedo);
popupMenu.addSeparator();
popupMenu.add(jMenuItemCut);
popupMenu.add(jMenuItemCopy);
popupMenu.add(jMenuItemPaste);
popupMenu.addSeparator();
if (jMenuItemInsCell.getAction().isEnabled()) {
popupMenu.add(jMenuItemInsCell);
jMenuItemInsCell.setEnabled(true);
popupMenu.add(jMenuItemInsRow);
jMenuItemInsRow.setEnabled(true);
popupMenu.addSeparator();
}
popupMenu.add(jMenuItemProp);
//Add ScreenCap to Menu
popupMenu.addSeparator();
popupMenu.add(jMenuItemScreenCap);
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}