import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
class borderExample {
public static void main(String args [])
{
Color hi = Color.cyan,lo=Color.blue;
EmptyBorder b0 = new EmptyBorder(10,10,10,10);
BevelBorder b1 = new BevelBorder(BevelBorder.RAISED,hi,lo);
EtchedBorder b2 = new EtchedBorder(EtchedBorder.LOWERED,hi,lo);
LineBorder b4 = new LineBorder(Color.orange,5);
MatteBorder b5 = new MatteBorder(20,10,20,10,Color.magenta);
TitledBorder b6 = new TitledBorder(b4,"Title");
CompoundBorder b7 = new CompoundBorder(b0,b1);
JLabel lb1,lb2,lb3,lb4,lb5,lb6,lb7;
JFrame f = new JFrame ("Border Exaple");
Container c = f.getContentPane ();
f.setSize(400,400);
f.setLocation(100,100);
JPanel p = new JPanel ();
p.setLayout (new GridLayout(7,1));
c.add(p);
lb1 = new JLabel ("Border No_1");
lb2 = new JLabel ("Border No_2");
lb3 = new JLabel ("Border No_3");
lb4 = new JLabel ("Border No_4");
lb5 = new JLabel ("Border No_5");
lb6 = new JLabel ("Border No_6");
lb7 = new JLabel ("Border No_7");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
lb1.setBorder(b0);
lb2.setBorder(b1);
lb2.setBorder(LineBorder.createBlackLineBorder());
lb3.setBorder(b2);
lb3.setBorder(BorderFactory.createLineBorder(Color.pink,10));
lb4.setBorder(b4);
lb5.setBorder(b5);
lb6.setBorder(b6);
lb7.setBorder(b7);
p.add(lb1);p.add(lb2);p.add(lb3);p.add(lb4);p.add(lb5);p.add(lb6);p.add(lb7);
}
}
OUTPUT :
import java.awt.*;
import javax.swing.border.*;
class borderExample {
public static void main(String args [])
{
Color hi = Color.cyan,lo=Color.blue;
EmptyBorder b0 = new EmptyBorder(10,10,10,10);
BevelBorder b1 = new BevelBorder(BevelBorder.RAISED,hi,lo);
EtchedBorder b2 = new EtchedBorder(EtchedBorder.LOWERED,hi,lo);
LineBorder b4 = new LineBorder(Color.orange,5);
MatteBorder b5 = new MatteBorder(20,10,20,10,Color.magenta);
TitledBorder b6 = new TitledBorder(b4,"Title");
CompoundBorder b7 = new CompoundBorder(b0,b1);
JLabel lb1,lb2,lb3,lb4,lb5,lb6,lb7;
JFrame f = new JFrame ("Border Exaple");
Container c = f.getContentPane ();
f.setSize(400,400);
f.setLocation(100,100);
JPanel p = new JPanel ();
p.setLayout (new GridLayout(7,1));
c.add(p);
lb1 = new JLabel ("Border No_1");
lb2 = new JLabel ("Border No_2");
lb3 = new JLabel ("Border No_3");
lb4 = new JLabel ("Border No_4");
lb5 = new JLabel ("Border No_5");
lb6 = new JLabel ("Border No_6");
lb7 = new JLabel ("Border No_7");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
lb1.setBorder(b0);
lb2.setBorder(b1);
lb2.setBorder(LineBorder.createBlackLineBorder());
lb3.setBorder(b2);
lb3.setBorder(BorderFactory.createLineBorder(Color.pink,10));
lb4.setBorder(b4);
lb5.setBorder(b5);
lb6.setBorder(b6);
lb7.setBorder(b7);
p.add(lb1);p.add(lb2);p.add(lb3);p.add(lb4);p.add(lb5);p.add(lb6);p.add(lb7);
}
}
OUTPUT :
No comments:
Post a Comment