Borders o You can set a border on any object of the JComponent class. Swing has several types of borders. To create a titled border use new Titled Border string title) To create a line border. use new Line border color color, int width), where width specifies the thickness of the line For example, the following code displays a titled border on a pane JPanel panel =new JPanelO panel set Border(new Title border( My Panel) Introduction to Java Programming, revised by Dai-kaiyuLiang,Introduction to Java Programming,revised by Dai-kaiyu 5 Borders ⚫You can set a border on any object of the JComponent class. Swing has several types of borders. To create a titled border, use new TitledBorder(String title). To create a line border, use new LineBorder(Color color, int width), where width specifies the thickness of the line. For example, the following code displays a titled border on a panel: JPanel panel = new JPanel(); panel.setBorder(new TitleBorder(“My Panel”));