Using Swing, what is the best way to indent some components underneath a checkbox or radio button? I need to make something in the style of Firefox 3.6's Options->Privacy dialog where some checkboxes are indented under a "main" checkbox. I can use any of the standard AWT/Swing layout's including GroupLayout. I also have JGoodies FormLayout available to me. I tried using setLeadingColumn offset in FormLayout at first, but it seemed like it was not going to work well unless I was indenting under a Separator. Maybe I was just doing it wrong?
Is there anything like SWT GridLayout's horizontalIndent setting? That would be perfect.
I am working with JDK1.6.0_23.
A BorderLayout places components in up to five areas: top, bottom, left, right, and center. All extra space is placed in the center area.
For this go to app > res > layout > activity_main. xml file and change the Constraint Layout to Absolute Layout and add TextViews.
Most common layouts: GridBagLayout - excellent when many components involved. BoxLayout (and associated Box class) - "glue" and "struts" (defined in Box , not BoxLayout ), combined with proper alignment and equalization of sizes, produce results pleasing to the eye. BorderLayout - often suitable for a top level ...
Create a JPanel for the sub components. Then you can add an EmptyBorder to the panel with the required indentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With