How do i change the position of the text in JCheckbox. I want the text to be on the left of the check box and not as default on the right. i been over the jcheckbox, jtooglebutton and jabstractButton api few times.
JCheckbox change the text position
jCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
It's actually inherited from AbstractButton, but you can find this also for JLabels (in this case, it's relative to the icon you may use in the label).
Now this is assuming you want just a particular change on this one component. If your goal is to reverse the direction of all components in your application (for example for a right to left reading), you should probably look into component orientation, with the setComponentOrientation and applyComponentOrientation methods.
If you are trying to do this within Netbeans IDE select HorizontalTextPosition and change to leadingJCheckBoxProperties
© 2022 - 2024 — McMap. All rights reserved.