本文整理了Java中javax.swing.JMenuItem.setDisabledIcon()
方法的一些代码示例,展示了JMenuItem.setDisabledIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setDisabledIcon()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setDisabledIcon
暂无
代码示例来源:origin: GoldenGnu/jeveassets
private static void createMenuItem(final JPopupMenu jPopupMenu, final String text, final String toolTipText, final Icon icon) {
JMenuItem jMenuItem = new JMenuItem(text);
jMenuItem.setToolTipText(toolTipText);
jMenuItem.setEnabled(false);
jMenuItem.setDisabledIcon(icon);
jMenuItem.setForeground(Color.BLACK);
jMenuItem.setHorizontalAlignment(SwingConstants.RIGHT);
jPopupMenu.add(jMenuItem);
}
代码示例来源:origin: GoldenGnu/jeveassets
public static void createDefault(final JPopupMenu jPopupMenu) {
JMenuItem jMenuItem;
jPopupMenu.addSeparator();
jMenuItem = new JMenuItem(GuiShared.get().selectionTitle());
jMenuItem.setDisabledIcon(Images.DIALOG_ABOUT.getIcon());
jMenuItem.setEnabled(false);
jMenuItem.setForeground(Color.BLACK);
jPopupMenu.add(jMenuItem);
JPanel jSpacePanel = new JPanel();
jSpacePanel.setOpaque(false);
jSpacePanel.setMinimumSize(new Dimension(50, 5));
jSpacePanel.setPreferredSize(new Dimension(50, 5));
jSpacePanel.setMaximumSize(new Dimension(50, 5));
jPopupMenu.add(jSpacePanel);
}
代码示例来源:origin: GoldenGnu/jeveassets
private static void createMenuItemGroup(final JPopupMenu jPopupMenu, final String text, final Icon icon) {
JMenuItem jMenuItem = new JMenuItem(text);
if (icon != null) {
jMenuItem.setDisabledIcon(icon);
}
jMenuItem.setEnabled(false);
if (border == null) {
border = BorderFactory.createCompoundBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(1, 0, 0, 0, jMenuItem.getBackground().darker()),
BorderFactory.createMatteBorder(1, 0, 0, 0, jMenuItem.getBackground().brighter())),
BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 0, 1, 0, jMenuItem.getBackground().brighter()),
BorderFactory.createMatteBorder(0, 0, 1, 0, jMenuItem.getBackground().darker())));
}
jMenuItem.setForeground(Color.BLACK);
jMenuItem.setBorder(border);
jMenuItem.setBorderPainted(true);
jPopupMenu.add(jMenuItem);
}
代码示例来源:origin: org.icepdf.os/icepdf-viewer
try {
jmi.setIcon(new ImageIcon(Images.get(imageName + "_a" + imageSize + ".png")));
jmi.setDisabledIcon(new ImageIcon(Images.get(imageName + "_i" + imageSize + ".png")));
jmi.setRolloverIcon(new ImageIcon(Images.get(imageName + "_r" + imageSize + ".png")));
} catch (NullPointerException e) {
jmi.setDisabledIcon(new ImageIcon(Images.get("menu_spacer.gif")));
jmi.setRolloverIcon(new ImageIcon(Images.get("menu_spacer.gif")));
代码示例来源:origin: xyz.cofe/docking-frames-core
private void updateDisabledIcon(){
Icon icon = getIcon( ActionContentModifier.DISABLED_HORIZONTAL, ActionContentModifier.NONE_HORIZONTAL, ActionContentModifier.NONE );
if( icon == null ){
icon = getIcon( ActionContentModifier.NONE_HORIZONTAL );
icon = DockUtilities.disabledIcon( getItem(), icon );
}
item.setDisabledIcon( icon );
}
代码示例来源:origin: cpesch/RouteConverter
private static void initializeItem(String name, JMenuItem item) {
item.setName(name);
item.setText(getString(name + "-action"));
String tooltip = getOptionalString(name + "-action-tooltip");
if (tooltip != null)
item.setToolTipText(tooltip);
setMnemonic(item, name + "-action-mnemonic");
String keystroke = getOptionalString(name + "-action-keystroke" + (isMac() ? "-mac" : ""));
if (keystroke != null)
item.setAccelerator(getKeyStroke(keystroke));
String iconUrl = getOptionalString(name + "-action-icon");
if (iconUrl != null) {
Icon icon = IconLoader.getIcon(iconUrl);
item.setIcon(icon);
item.setDisabledIcon(icon);
}
}
代码示例来源:origin: digital-preservation/droid
jMenuSave.setToolTipText("Save a profile");
jMenuSave.setActionCommand("save");
jMenuSave.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/icons/Save Blue 16 d g.gif"))); // NOI18N
jMenuSave.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/icons/Save Blue 16 d g.gif"))); // NOI18N
jMenuSave.addActionListener(new java.awt.event.ActionListener() {
jMenuSaveAs.setToolTipText("Save a profile to a specified file");
jMenuSaveAs.setActionCommand("save");
jMenuSaveAs.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Save As small disabled.png"))); // NOI18N
jMenuSaveAs.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Save As small disabled.png"))); // NOI18N
jMenuSaveAs.addActionListener(new java.awt.event.ActionListener() {
jMenuItemAddFileOrFolders.setText("Add file/folders");
jMenuItemAddFileOrFolders.setToolTipText("Add files or folders to a profile");
jMenuItemAddFileOrFolders.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Add small disabled.png"))); // NOI18N
jMenuItemAddFileOrFolders.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Add small disabled.png"))); // NOI18N
jMenuItemAddFileOrFolders.addActionListener(new java.awt.event.ActionListener() {
jMenuItemRemoveFolder.setText("Remove files/folders");
jMenuItemRemoveFolder.setToolTipText("Remove files or folders from a profile");
jMenuItemRemoveFolder.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Remove small disabled.png"))); // NOI18N
jMenuItemRemoveFolder.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Remove small disabled.png"))); // NOI18N
jMenuItemRemoveFolder.addActionListener(new java.awt.event.ActionListener() {
jMenuItemStart.setText("Start identification");
jMenuItemStart.setToolTipText("Start identifying files in the profile");
jMenuItemStart.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Play small disabled.png"))); // NOI18N
jMenuItemStart.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Play small disabled.png"))); // NOI18N
jMenuItemStart.addActionListener(new java.awt.event.ActionListener() {
代码示例来源:origin: uk.gov.nationalarchives/droid-ui
jMenuSave.setToolTipText("Save a profile");
jMenuSave.setActionCommand("save");
jMenuSave.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/icons/Save Blue 16 d g.gif"))); // NOI18N
jMenuSave.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/icons/Save Blue 16 d g.gif"))); // NOI18N
jMenuSave.addActionListener(new java.awt.event.ActionListener() {
jMenuSaveAs.setToolTipText("Save a profile to a specified file");
jMenuSaveAs.setActionCommand("save");
jMenuSaveAs.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Save As small disabled.png"))); // NOI18N
jMenuSaveAs.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Save As small disabled.png"))); // NOI18N
jMenuSaveAs.addActionListener(new java.awt.event.ActionListener() {
jMenuItemAddFileOrFolders.setText("Add file/folders");
jMenuItemAddFileOrFolders.setToolTipText("Add files or folders to a profile");
jMenuItemAddFileOrFolders.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Add small disabled.png"))); // NOI18N
jMenuItemAddFileOrFolders.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Add small disabled.png"))); // NOI18N
jMenuItemAddFileOrFolders.addActionListener(new java.awt.event.ActionListener() {
jMenuItemRemoveFolder.setText("Remove files/folders");
jMenuItemRemoveFolder.setToolTipText("Remove files or folders from a profile");
jMenuItemRemoveFolder.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Remove small disabled.png"))); // NOI18N
jMenuItemRemoveFolder.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Remove small disabled.png"))); // NOI18N
jMenuItemRemoveFolder.addActionListener(new java.awt.event.ActionListener() {
jMenuItemStart.setText("Start identification");
jMenuItemStart.setToolTipText("Start identifying files in the profile");
jMenuItemStart.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Play small disabled.png"))); // NOI18N
jMenuItemStart.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/gov/nationalarchives/droid/OldIcons/Play small disabled.png"))); // NOI18N
jMenuItemStart.addActionListener(new java.awt.event.ActionListener() {
代码示例来源:origin: JChemPaint/jchempaint
Image disabledimg = disabledimage.getImage();
Image disablednewimg = disabledimg.getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH);
mi.setDisabledIcon(new ImageIcon(disablednewimg));
代码示例来源:origin: GoldenGnu/jeveassets
jIskValue.setForeground(Color.BLACK);
jIskValue.setHorizontalAlignment(SwingConstants.RIGHT);
jIskValue.setDisabledIcon(Images.TOOL_VALUES.getIcon());
jPopupMenu.add(jIskValue);
jDateValue.setForeground(Color.BLACK);
jDateValue.setHorizontalAlignment(SwingConstants.RIGHT);
jDateValue.setDisabledIcon(Images.EDIT_DATE.getIcon());
jPopupMenu.add(jDateValue);
jNote.setEnabled(false);
jNote.setForeground(Color.BLACK);
jNote.setDisabledIcon(Images.SETTINGS_USER_NAME.getIcon());
jPopupMenu.add(jNote);
内容来源于网络,如有侵权,请联系作者删除!