⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e750. adding a disabled icon to a jbutton component.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
By default, when a button is disabled, it automatically generates a grayed-out version of the installed icon. However, it is possible to set a specific icon to use when the button is disabled. 
    // To create a button with an icon, see e746 Adding an Icon to a JButton Component
    
    // Icon will appear gray
    button.setEnabled(false);
    
    // Set a disabled version of icon
    Icon disabledIcon = new ImageIcon("dicon.gif");
    button.setDisabledIcon(disabledIcon);
    
    // To remove the disabled version of the icon, set to null
    button.setDisabledIcon(null);
    
    // If original icon is set as the disabled icon, disabling
    // the button will have no effect on the icon
    button.setDisabledIcon(icon);

 Related Examples 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -