本文整理汇总了Java中javax.swing.JMenuItem.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java JMenuItem.setVisible方法的具体用法?Java JMenuItem.setVisible怎么用?Java JMenuItem.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenuItem
的用法示例。
在下文中一共展示了JMenuItem.setVisible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureMenuItem
import javax.swing.JMenuItem; //导入方法依赖的package包/类
private void configureMenuItem (JMenuItem item, String containerCtx, String action, ActionProvider provider, Map context) {
// System.err.println("ConfigureMenuItem: " + containerCtx + "/" + action);
item.setName(action);
item.putClientProperty(KEY_ACTION, action);
item.putClientProperty(KEY_CONTAINERCONTEXT, containerCtx);
item.putClientProperty(KEY_CREATOR, this);
item.setText(
provider.getDisplayName(action, containerCtx));
item.setToolTipText(provider.getDescription(action, containerCtx));
int state = context == null ? ActionProvider.STATE_ENABLED | ActionProvider.STATE_VISIBLE :
provider.getState (action, containerCtx, context);
boolean enabled = (state & ActionProvider.STATE_ENABLED) != 0;
item.setEnabled(enabled);
boolean visible = (state & ActionProvider.STATE_VISIBLE) != 0;
//Intentionally use enabled property
item.setVisible(enabled);
item.setMnemonic(provider.getMnemonic(action, containerCtx));
item.setDisplayedMnemonicIndex(provider.getMnemonicIndex(action, containerCtx));
item.setIcon(provider.getIcon(action, containerCtx, BeanInfo.ICON_COLOR_16x16));
}
示例2: configureMenuItem
import javax.swing.JMenuItem; //导入方法依赖的package包/类
private void configureMenuItem (JMenuItem item, String containerCtx, String action, ActionProvider provider, Map context) {
// System.err.println("ConfigureMenuItem: " + containerCtx + "/" + action);
item.setName(action);
item.putClientProperty(KEY_ACTION, action);
item.putClientProperty(KEY_CONTAINERCONTEXT, containerCtx);
item.putClientProperty(KEY_CREATOR, this);
item.setText(
provider.getDisplayName(action, containerCtx));
// System.err.println(" item text is " + item.getText());
item.setToolTipText(provider.getDescription(action, containerCtx));
int state = context == null ? ActionProvider.STATE_ENABLED | ActionProvider.STATE_VISIBLE :
provider.getState (action, containerCtx, context);
boolean enabled = (state & ActionProvider.STATE_ENABLED) != 0;
// System.err.println("action " + action + (enabled ? " enabled" : " disabled"));
item.setEnabled(enabled);
boolean visible = (state & ActionProvider.STATE_VISIBLE) != 0;
// System.err.println("action " + action + (visible ? " visible" : " invisible"));
item.setVisible(visible);
item.setMnemonic(provider.getMnemonic(action, containerCtx));
item.setDisplayedMnemonicIndex(provider.getMnemonicIndex(action, containerCtx));
item.setIcon(provider.getIcon(action, containerCtx, BeanInfo.ICON_COLOR_16x16));
}
示例3: initUndecorated
import javax.swing.JMenuItem; //导入方法依赖的package包/类
JMenuItem initUndecorated(){
JMenuItem undecorated = new JCheckBoxMenuItem("Undecorated");
undecorated.setVisible(true);
undecorated.addActionListener((ActionEvent e) -> {
parrentFrame.dispose();
parrentFrame.setUndecorated(undecorated.isSelected());
parrentFrame.setVisible(true);
});
return undecorated;
}
示例4: initAlwaysOnTop
import javax.swing.JMenuItem; //导入方法依赖的package包/类
JMenuItem initAlwaysOnTop(){
JMenuItem alwaysOnTop = new JCheckBoxMenuItem("Always on Top");
alwaysOnTop.setVisible(true);
alwaysOnTop.addActionListener((ActionEvent e) -> {
parrentFrame.setjTimeAlwaysOnTop(!parrentFrame.isjTimeAlwaysOnTop());
parrentFrame.setAlwaysOnTop(parrentFrame.isjTimeAlwaysOnTop());
alwaysOnTop.setArmed(parrentFrame.isjTimeAlwaysOnTop());
});
return alwaysOnTop;
}