I Want to change the JButton icon when user press/release the button.
A icon image when the JButton were selected
A icon image when the JButton were unselected and the JButton were release:
How can I do this?
JButton b = new JButton(Icon x); // Create button with normal icon
b.setIcon(Icon x);
b.setDisabledIcon(Icon x);
b.setPressedIcon(Icon x);
b.setSelectedIcon(Icon x);
b.setDisabledSelectedIcon(Icon x);
ref: http://www.leepoint.net/notes-java/GUI/components/20buttons/23buttonicons.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.