What is the way to set horizontal and vertical margins in a panel? (The same thing we have in html style="margins:30px")
style="margins:30px"
Use setBorder(BorderFactory.createEmptyBorder(int top, int left, int bottom, int right); for more help visit this.
setBorder(BorderFactory.createEmptyBorder(int top, int left, int bottom, int right);
I don’t know html, so just guess the possible equivalents :-)
BorderLayout JPanel.
, . , Gridbaglayout ,
"" JComponents LayoutManagers
BorderLayout (int horizontalGap, int verticalGap)
GridLayout (int rows, int cols, int hgap, int vgap)
1 / multi-user JPanels (with a different LayoutManager for each of the JPanels too)
2 / using How to use GridBagLayout (by multiplying JPanels with different LayoutManegars for each JPanel ...)
3 / use some Custom LayoutManager