If I add components like JButtons on the East or West side, how do I prevent it from hugging the side of the screen? I want some space between the JButtons and the edge of the screen.
If I add components like JButton s on the East or West side, how
Share
call
setBorderon your JButton like this:From the JavaDoc, an EmptyBorder is a “transparent border which takes up space but does no drawing”. In my example it shall take 3 pixels respectively top, left, bottom and right.
Complete code whose purpose is only to show how to use EmptyBorder: