Setting the Gap Size Between the Label and Icon in a JButton Component
import javax.swing.JButton;
publicclass Main {
publicstaticvoid main(String[] argv) throws Exception {
JButton button = new JButton();
// Get gap size; default is 4
int gapSize = button.getIconTextGap();
// Set gap size
button.setIconTextGap(8);
}
}