borland Packages Class Hierarchy dbswing Package
java.lang.Object +----com.borland.dbswing.BorderIcon
Constructors Properties Methods
Implements Serializable, Icon
BorderIcon
is a utility class for creating an Icon
with a Border
. It offers a convenient way of dynamically creating rollover icons out of ImageIcons
without having to create multiple image files.
For example, to create a typical rollover icon (an icon with raised edges) out of an ImageIcon
, do this:
ImageIcon imageIcon = new ImageIcon("image.gif"); JButton jButton = new JButton(imageIcon); jButton.setRolloverIcon(new BorderIcon(imageIcon)); jButton.setBorder(null); // allows image with border to fill entire button
BorderIcon
uses a raised bevel border by default if a border is not explicitly specified.
public BorderIcon()Creates a
BorderIcon
with no specified border or icon. Calls the constructor of this
class which takes a Border
and an Icon
as parameters. Instantiates a new border using BorderFactory's
createRaisedBevelBorder()
method, and passes this new border, along with null
for the Icon
, to the other constructor.
public BorderIcon(Border border)Creates a
BorderIcon
with the specified border. Calls the constructor of this
class which takes a Border
and an Icon
as parameters. Passes the specified Border
and null
for the Icon
to the other constructor.
border
Border
that becomes the border for the icon.
public BorderIcon(Border border, Icon icon)Creates a
BorderIcon
with a specified border and icon.
border
Border
that becomes the border for the icon.
icon
Icon
that becomes the icon for the BorderIcon
.
public BorderIcon(Icon icon)Creates a
BorderIcon
with a specified icon. Calls the constructor of this
class which takes a Border
and an Icon
as parameters. Instantiates a new border using BorderFactory's
createRaisedBevelBorder()
method, and passes this new border, along with the specified icon, to the other constructor.
icon
Icon
that becomes the icon for the BorderIcon
.
public Border getBorder() public void setBorder(Border border)Returns and sets the border for this icon. The default border is a raised-bevel border.
public Icon getIcon() public void setIcon(Icon icon)Returns and sets the icon used by this icon.
public int getIconHeight()This is an implementation of the
Icon
interface. It returns the height of this icon.
public int getIconWidth()This is an implementation of the
Icon
interface. It returns the width of this icon.