javax.swing.border
Class CompoundBorder

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.border.AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder 
      extended by javax.swing.border.CompoundBorder
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border
Direct Known Subclasses:
BorderUIResource.CompoundBorderUIResource sample code for javax.swing.plaf.BorderUIResource.CompoundBorderUIResource definition code for javax.swing.plaf.BorderUIResource.CompoundBorderUIResource

public class CompoundBorder
extends AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder

A composite Border class used to compose two Border objects into a single border by nesting an inside Border object within the insets of an outside Border object. For example, this class may be used to add blank margin space to a component with an existing decorative border:

    Border border = comp.getBorder();
    Border margin = new EmptyBorder(10,10,10,10);
    comp.setBorder(new CompoundBorder(border, margin));
 

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Field Summary
protected  Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border insideBorder sample code for javax.swing.border.CompoundBorder.insideBorder definition code for javax.swing.border.CompoundBorder.insideBorder
           
protected  Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border outsideBorder sample code for javax.swing.border.CompoundBorder.outsideBorder definition code for javax.swing.border.CompoundBorder.outsideBorder
           
 
Constructor Summary
CompoundBorder sample code for javax.swing.border.CompoundBorder.CompoundBorder() definition code for javax.swing.border.CompoundBorder.CompoundBorder() ()
          Creates a compound border with null outside and inside borders.
CompoundBorder sample code for javax.swing.border.CompoundBorder.CompoundBorder(javax.swing.border.Border, javax.swing.border.Border) definition code for javax.swing.border.CompoundBorder.CompoundBorder(javax.swing.border.Border, javax.swing.border.Border) (Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  outsideBorder, Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  insideBorder)
          Creates a compound border with the specified outside and inside borders.
 
Method Summary
 Insets sample code for java.awt.Insets definition code for java.awt.Insets getBorderInsets sample code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component) definition code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component) (Component sample code for java.awt.Component definition code for java.awt.Component  c)
          Returns the insets of the composite border by adding the insets of the outside border to the insets of the inside border.
 Insets sample code for java.awt.Insets definition code for java.awt.Insets getBorderInsets sample code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component, java.awt.Insets) definition code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component, java.awt.Insets) (Component sample code for java.awt.Component definition code for java.awt.Component  c, Insets sample code for java.awt.Insets definition code for java.awt.Insets  insets)
          Reinitialize the insets parameter with this Border's current Insets.
 Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border getInsideBorder sample code for javax.swing.border.CompoundBorder.getInsideBorder() definition code for javax.swing.border.CompoundBorder.getInsideBorder() ()
          Returns the inside border object.
 Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border getOutsideBorder sample code for javax.swing.border.CompoundBorder.getOutsideBorder() definition code for javax.swing.border.CompoundBorder.getOutsideBorder() ()
          Returns the outside border object.
 boolean isBorderOpaque sample code for javax.swing.border.CompoundBorder.isBorderOpaque() definition code for javax.swing.border.CompoundBorder.isBorderOpaque() ()
          Returns whether or not this compound border is opaque.
 void paintBorder sample code for javax.swing.border.CompoundBorder.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) definition code for javax.swing.border.CompoundBorder.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) (Component sample code for java.awt.Component definition code for java.awt.Component  c, Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, int x, int y, int width, int height)
          Paints the compound border by painting the outside border with the specified position and size and then painting the inside border at the specified position and size offset by the insets of the outside border.
 
Methods inherited from class javax.swing.border.AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder
getInteriorRectangle sample code for javax.swing.border.AbstractBorder.getInteriorRectangle(java.awt.Component, javax.swing.border.Border, int, int, int, int) definition code for javax.swing.border.AbstractBorder.getInteriorRectangle(java.awt.Component, javax.swing.border.Border, int, int, int, int) , getInteriorRectangle sample code for javax.swing.border.AbstractBorder.getInteriorRectangle(java.awt.Component, int, int, int, int) definition code for javax.swing.border.AbstractBorder.getInteriorRectangle(java.awt.Component, int, int, int, int)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

outsideBorder sample code for javax.swing.border.CompoundBorder.outsideBorder

protected Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  outsideBorder

insideBorder sample code for javax.swing.border.CompoundBorder.insideBorder

protected Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  insideBorder
Constructor Detail

CompoundBorder sample code for javax.swing.border.CompoundBorder() definition code for javax.swing.border.CompoundBorder()

public CompoundBorder()
Creates a compound border with null outside and inside borders.


CompoundBorder sample code for javax.swing.border.CompoundBorder(javax.swing.border.Border, javax.swing.border.Border) definition code for javax.swing.border.CompoundBorder(javax.swing.border.Border, javax.swing.border.Border)

public CompoundBorder(Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  outsideBorder,
                      Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  insideBorder)
Creates a compound border with the specified outside and inside borders. Either border may be null.

Parameters:
outsideBorder - the outside border
insideBorder - the inside border to be nested
Method Detail

isBorderOpaque sample code for javax.swing.border.CompoundBorder.isBorderOpaque() definition code for javax.swing.border.CompoundBorder.isBorderOpaque()

public boolean isBorderOpaque()
Returns whether or not this compound border is opaque. Returns true if both the inside and outside borders are non-null and opaque; returns false otherwise.

Specified by:
isBorderOpaque sample code for javax.swing.border.Border.isBorderOpaque() definition code for javax.swing.border.Border.isBorderOpaque() in interface Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border
Overrides:
isBorderOpaque sample code for javax.swing.border.AbstractBorder.isBorderOpaque() definition code for javax.swing.border.AbstractBorder.isBorderOpaque() in class AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder
Returns:
false

paintBorder sample code for javax.swing.border.CompoundBorder.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) definition code for javax.swing.border.CompoundBorder.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int)

public void paintBorder(Component sample code for java.awt.Component definition code for java.awt.Component  c,
                        Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                        int x,
                        int y,
                        int width,
                        int height)
Paints the compound border by painting the outside border with the specified position and size and then painting the inside border at the specified position and size offset by the insets of the outside border.

Specified by:
paintBorder sample code for javax.swing.border.Border.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) definition code for javax.swing.border.Border.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) in interface Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border
Overrides:
paintBorder sample code for javax.swing.border.AbstractBorder.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) definition code for javax.swing.border.AbstractBorder.paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int) in class AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder
Parameters:
c - the component for which this border is being painted
g - the paint graphics
x - the x position of the painted border
y - the y position of the painted border
width - the width of the painted border
height - the height of the painted border

getBorderInsets sample code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component, java.awt.Insets) definition code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component, java.awt.Insets)

public Insets sample code for java.awt.Insets definition code for java.awt.Insets  getBorderInsets(Component sample code for java.awt.Component definition code for java.awt.Component  c,
                              Insets sample code for java.awt.Insets definition code for java.awt.Insets  insets)
Reinitialize the insets parameter with this Border's current Insets.

Overrides:
getBorderInsets sample code for javax.swing.border.AbstractBorder.getBorderInsets(java.awt.Component, java.awt.Insets) definition code for javax.swing.border.AbstractBorder.getBorderInsets(java.awt.Component, java.awt.Insets) in class AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder
Parameters:
c - the component for which this border insets value applies
insets - the object to be reinitialized
Returns:
the insets object

getBorderInsets sample code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component) definition code for javax.swing.border.CompoundBorder.getBorderInsets(java.awt.Component)

public Insets sample code for java.awt.Insets definition code for java.awt.Insets  getBorderInsets(Component sample code for java.awt.Component definition code for java.awt.Component  c)
Returns the insets of the composite border by adding the insets of the outside border to the insets of the inside border.

Specified by:
getBorderInsets sample code for javax.swing.border.Border.getBorderInsets(java.awt.Component) definition code for javax.swing.border.Border.getBorderInsets(java.awt.Component) in interface Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border
Overrides:
getBorderInsets sample code for javax.swing.border.AbstractBorder.getBorderInsets(java.awt.Component) definition code for javax.swing.border.AbstractBorder.getBorderInsets(java.awt.Component) in class AbstractBorder sample code for javax.swing.border.AbstractBorder definition code for javax.swing.border.AbstractBorder
Parameters:
c - the component for which this border insets value applies
Returns:
the new Insets object initialized to 0

getOutsideBorder sample code for javax.swing.border.CompoundBorder.getOutsideBorder() definition code for javax.swing.border.CompoundBorder.getOutsideBorder()

public Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  getOutsideBorder()
Returns the outside border object.


getInsideBorder sample code for javax.swing.border.CompoundBorder.getInsideBorder() definition code for javax.swing.border.CompoundBorder.getInsideBorder()

public Border sample code for javax.swing.border.Border definition code for javax.swing.border.Border  getInsideBorder()
Returns the inside border object.