Ejemplo n.º 1
0
 /**
  * Creates a copy of this cell constraints object.
  *
  * @return a copy of this cell constraints object
  */
 public Object clone() {
   try {
     CellConstraints c = (CellConstraints) super.clone();
     c.insets = (Insets) insets.clone();
     return c;
   } catch (CloneNotSupportedException e) {
     // This shouldn't happen, since we are Cloneable.
     throw new InternalError();
   }
 }
  public BlockBorder(Insets outerMargin, Insets innerMargin, Color aShade1, Color aShade2) {
    if (outerMargin == null) {
      outerMargin = EMPTY;
    }
    myOuterMargin = (Insets) outerMargin.clone();
    myInsets = (Insets) outerMargin.clone();
    myInsets.top += DEFAULT_INSETS.top;
    myInsets.left += DEFAULT_INSETS.left;
    myInsets.bottom += DEFAULT_INSETS.bottom;
    myInsets.right += DEFAULT_INSETS.right;

    if (innerMargin == null) {
      innerMargin = EMPTY;
    }
    myInsets.top += innerMargin.top;
    myInsets.left += innerMargin.left;
    myInsets.bottom += innerMargin.bottom;
    myInsets.right += innerMargin.right;

    myShade1 = aShade1;
    myShade2 = aShade2;
  }
 @Override
 public Insets getBorderInsets(final Component c) {
   return (Insets) myInsets.clone();
 }
Ejemplo n.º 4
0
 /**
  * Returns the insets of the border.
  *
  * @param c the component for which this border insets value applies
  */
 public Insets getBorderInsets(Component c) {
   return (Insets) borderInsets.clone();
 }