1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package com.iailab.netsdk.common;
 
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.border.Border;
 
/*
 * 边框设置
 */
public class BorderEx {
    public static void set(JComponent object, String title, int width) {
        Border innerBorder = BorderFactory.createTitledBorder(title);
        Border outerBorder = BorderFactory.createEmptyBorder(width, width, width, width);
        object.setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder));     
    }
 
}