"I read about setting up an empty border with a certain thickness, but that will replace the current border. How can I add this margin?"
See CompoundBorder
The component Border class used to create two Border objects into a single border by nesting inside the Border object inside the attachments of the external Border object. For example, this class can be used to add a space to a field with a component with an existing decorative border:
Border border = comp.getBorder(); Border margin = new EmptyBorder(10,10,10,10); comp.setBorder(new CompoundBorder(border, margin));
Also see EmptyBorder
source share