Display page for Borders at www.BruceEckel.com
Borders.java
//: c14:Borders.java
// Different Swing borders.
// <applet code=Borders width=500 height=300></applet>
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
import com.bruceeckel.swing.*;
public class Borders extends JApplet {
static JPanel showBorder(Border b) {
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
String nm = b.getClass().toString();
nm = nm.substring(nm.lastIndexOf('.') + 1);
jp.add(new JLabel(nm, JLabel.CENTER),
BorderLayout.CENTER);
jp.setBorder(b);
return jp;
}
public void init() {
Container cp = getContentPane();
cp.setLayout(new GridLayout(2,4));
cp.add(showBorder(new TitledBorder("Title")));
cp.add(showBorder(new EtchedBorder()));
cp.add(showBorder(new LineBorder(Color.BLUE)));
cp.add(showBorder(
new MatteBorder(5,5,30,30,Color.GREEN)));
cp.add(showBorder(
new BevelBorder(BevelBorder.RAISED)));
cp.add(showBorder(
new SoftBevelBorder(BevelBorder.LOWERED)));
cp.add(showBorder(new CompoundBorder(
new EtchedBorder(),
new LineBorder(Color.RED))));
}
public static void main(String[] args) {
Console.run(new Borders(), 500, 300);
}
} ///:~
Wyszukiwarka
Podobne podstrony:
border top colorBon Jovi BorderlineBorderFactoryNo Man s land Gender bias and social constructivism in the diagnosis of borderline personality disorborderborder widthborderlinesMadonna BorderlineBorderLayoutBorderUIResource TitledBorderUIResourceBorderUIResource EtchedBorderUIResourcewięcej podobnych podstron