这个压缩包里的都是超级经典的java例子
源代码在线查看: borders.htm
Creating and Setting a Border (Java Developers Almanac Example)
The Java Developers Almanac 1.4
Order this book from Amazon.
google_ad_client = "pub-6001183370374757";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel = "4777242811";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "6666CC";
google_color_url = "6666CC";
google_color_text = "000000";
//-->
Home
>
List of Packages
>
javax.swing.border
[3 examples]
e873. Creating and Setting a Border
There are several types of borders available, each represented by its
own class. A border can be created using the class' constructor or
using a border factory. The border factory is the typical method for
creating a border since it creates the border using values that are
compatible with the current look and feel. However, if custom values
are required, the border should be created using a constructor.
This example creates one of each of the available borders.
See also e874 Adding a Title to a Border.
// Create a border
EmptyBorder emptyBorder = (EmptyBorder)BorderFactory.createEmptyBorder();
LineBorder lineBorder = (LineBorder)BorderFactory.createLineBorder(Color.black);
EtchedBorder etchedBorder = (EtchedBorder)BorderFactory.createEtchedBorder();
BevelBorder raisedBevelBorder = (BevelBorder)BorderFactory.createRaisedBevelBorder();
BevelBorder loweredBevelBorder = (BevelBorder)BorderFactory.createLoweredBevelBorder();
ImageIcon icon = new ImageIcon("image.gif");
MatteBorder matteBorder = (MatteBorder)BorderFactory.createMatteBorder(-1, -1, -1, -1, icon);
// Set the border
component.setBorder(emptyBorder);
Related Examples
e874.
Adding a Title to a Border
e875.
Creating a Compound Border
© 2002 Addison-Wesley.