| |
创建和设置线边界BorderFactory |
|
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.border.LineBorder;
public class Main {
public static void main(String[] argv) {
LineBorder lineBorder = (LineBorder)BorderFactory.createLineBorder(Color.black);
JLabel component = new JLabel("label");
component.setBorder(lineBorder);
}
}
|
|
|
Related examples in the same category |
1. | BorderFactory.createLineBorder: create line border | | | 2. | BorderFactory.createEtchedBorder: create Etched Border | | | 3. | BorderFactory.createEtchedBorder: LOWERED EtchedBorder | | | 4. | BorderFactory.createRaisedBevelBorder | | | 5. | BorderFactory.createLoweredBevelBorder | | | 6. | BorderFactory.createEmptyBorder(10, 10, 10, 10) | | | 7. | BorderFactory.createTitledBorder("Title Border") | | | 8. | BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Title Lowered Etched Border") | | | 9. | BorderFactory.createMatteBorder(2, 5, 2, 5, Color.BLUE) | | | 10. | BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLUE), "Title Line Border with color") | | | 11. | BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()) | | | 12. | BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), BorderFactory.createMatteBorder(-1, -1, -1, -1, icon)) | | | 13. | BorderFactory.createEmptyBorder | | | 14. | 创建和设置一个空的边界BorderFactory | | | 15. | 从BorderFactory创建和设置一个EtchedBorder | | | 16. | Creating and Setting a Raised BevelBorder from BorderFactory | | | 17. | 从BorderFactory创建和设置降低BevelBorder | | | 18. | 从BorderFactory创建和设置MatteBorder | | | 19. | 创建一个复合边境 | | |
|