Here you can find all the necessary information.
Basically, you can use a border factory to create a border using the types available in Swing:
Border lineBorder = BorderFactory.createLineBorder(Color.black); JPanel panel = new JPanel(); panel.setBorder(lineBorder);
You can also define your user boundaries by implementing the border interface .
Heisenbug
source share