Пример #1
0
 /**
  * Layout the receiver. This method set insideBounds & insets according to bounds. Insets is
  * borderWidth + spacing.
  *
  * @see updateDrawableBounds
  */
 protected void layoutComponent() {
   Insets in = (Insets) getInsets().clone();
   in.top += spacing.top;
   in.left += spacing.left;
   in.bottom += spacing.bottom;
   in.right += spacing.right;
   Dimension d = getSize();
   insideBounds.setBounds(
       in.left, in.top, d.width - in.left - in.right, d.height - in.top - in.bottom);
   updateDrawableBounds();
 }
Пример #2
0
 /** Update the drawableBounds member according to insideBounds and spacing. */
 protected void updateDrawableBounds() {
   // here, we would like to avoid Rectangle creation
   drawableBounds.x = insideBounds.x - spacing.left;
   drawableBounds.y = insideBounds.y - spacing.top;
   drawableBounds.width = insideBounds.width + spacing.left + spacing.right;
   drawableBounds.height = insideBounds.height + spacing.top + spacing.bottom;
   Dimension d = getDepth();
   backRectangle.setToBackRectangleOf(insideBounds, d);
   frontRectangle.setToFrontRectangleOf(insideBounds, d);
 }