import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
public class EmptyBorderSample {
public static void main(String args[]) {
JFrame frame = new JFrame("Sample Borders");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Border emptyBorder = new EmptyBorder(5, 10, 5, 10);
JLabel aLabel = new JLabel("Bevel");
aLabel.setBorder(emptyBorder);
aLabel.setHorizontalAlignment(JLabel.CENTER);
frame.add(aLabel);
frame.setSize(400, 200);
frame.setVisible(true);
}
}
|