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