import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.LineBorder;
public class CompoundBorderLabel extends JFrame {
JLabel label = new JLabel("A label with some borders");
public CompoundBorderLabel() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Border border1 = new CompoundBorder(LineBorder.createBlackLineBorder(),
BorderFactory.createLineBorder(Color.red, 20));
Border border2 = new CompoundBorder(border1, BorderFactory
.createLoweredBevelBorder());
label.setBorder(border2);
getContentPane().add(label, BorderLayout.CENTER);
pack();
}
public static void main(String arg[]) {
CompoundBorderLabel m = new CompoundBorderLabel();
m.setVisible(true);
}
}
|