See Images - ImageIcon for an explanation of how to use ImageIcons for buttons.
JButton next = new JButton(new ImageIcon("right.gif"));or
JButton next = new JButton("Next", rightArrow);
Java computes two button images automatically: the disabled image
is computed from the normal image, and the
selected, disabled image is computed
from the selected image if one is supplied.
Rollover image changes are not
automatic -- first you must call
b.setRolloverEnabled(true);
.
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); b.setRolloverEnabled(boolean b); // turn on before rollovers work b.setRolloverIcon(Icon x); // b.setRolloverSelectedIcon(Icon x);