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