我想改变 Swing 中 JButton 的背景图像,方法 :Button.setIcon(),只设置图标不设置背景, 有没有easy怎么办?
您仍然可以使用setIcon但您需要设置对齐方式以使文本出现在图像上
setIcon
button.setHorizontalTextPosition(SwingConstants.CENTER);