javax.swing.border


1. Basic Border:

import javax.swing.border.Border;
import javax.swing.border.LineBorder;

Border border = new LineBorder(Color.RED);

2. Title Border:

import javax.swing.border.TitledBorder;

TitledBorder border = new TitledBorder("My Title");

3. Compound Border:

import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.LineBorder;

Border outerBorder = new LineBorder(Color.RED, 5);
Border innerBorder = new LineBorder(Color.BLUE, 2);
Border compoundBorder = new CompoundBorder(outerBorder, innerBorder);

4. Empty Border:

import javax.swing.border.EmptyBorder;

Border border = new EmptyBorder(5, 10, 15, 20); // Top, left, bottom, right margins

5. Bevel Border:

6. Matte Border:

7. Etched Border:

8. Line Border:

9. Dashed Line Border:

10. Soft Bevel Border:

11. Titled Line Border:

12. Compound Border with Title:

13. Gradient Border:

14. Round Rect Border:

15. Matte Border with Rounded Corners:

16. Compound Border with Gradient and Title:

17. Scalable Border:

18. Dotted Line Border:

19. Compound Border with Rounded Corner:

20. Compound Border with Matte Border and Title:

21. Compound Border with Gradient, Title, and Dashed Line:

22. Compound Border with Matte Border and Soft Bevel Border:

23. Compound Border with Title, Line Border, and Etched Border:

24. Compound Border with Gradient, Title, and Rounded Corner:

25. Compound Border with Matte Border, Line Border, and Title:

26. Compound Border with Gradient, Title, Line Border, and Dashed Line:

27. Compound Border with Matte Border, Soft Bevel Border, and Title:

28. Compound Border with Title, Line Border, Etched Border, and Dashed Line: