本文整理匯總了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());
}
}