- public void drawBox(int left, int top, int right, int bottom,
- CellAttributes border, CellAttributes background, int borderType,
- boolean shadow) {
-
- int boxTop = top;
- int boxLeft = left;
- int boxWidth = right - left;
- int boxHeight = bottom - top;
-
- char cTopLeft;
- char cTopRight;
- char cBottomLeft;
- char cBottomRight;
- char cHSide;
- char cVSide;
-
- switch (borderType) {
- case 1:
- cTopLeft = GraphicsChars.ULCORNER;
- cTopRight = GraphicsChars.URCORNER;
- cBottomLeft = GraphicsChars.LLCORNER;
- cBottomRight = GraphicsChars.LRCORNER;
- cHSide = GraphicsChars.SINGLE_BAR;
- cVSide = GraphicsChars.WINDOW_SIDE;
- break;
-
- case 2:
- cTopLeft = GraphicsChars.WINDOW_LEFT_TOP_DOUBLE;
- cTopRight = GraphicsChars.WINDOW_RIGHT_TOP_DOUBLE;
- cBottomLeft = GraphicsChars.WINDOW_LEFT_BOTTOM_DOUBLE;
- cBottomRight = GraphicsChars.WINDOW_RIGHT_BOTTOM_DOUBLE;
- cHSide = GraphicsChars.DOUBLE_BAR;
- cVSide = GraphicsChars.WINDOW_SIDE_DOUBLE;
- break;
-
- case 3:
- cTopLeft = GraphicsChars.WINDOW_LEFT_TOP;
- cTopRight = GraphicsChars.WINDOW_RIGHT_TOP;
- cBottomLeft = GraphicsChars.WINDOW_LEFT_BOTTOM;
- cBottomRight = GraphicsChars.WINDOW_RIGHT_BOTTOM;
- cHSide = GraphicsChars.WINDOW_TOP;
- cVSide = GraphicsChars.WINDOW_SIDE;
- break;
- default:
- throw new IllegalArgumentException("Invalid border type: " + borderType);
- }
-
- // Place the corner characters
- putCharXY(left, top, cTopLeft, border);
- putCharXY(left + boxWidth - 1, top, cTopRight, border);
- putCharXY(left, top + boxHeight - 1, cBottomLeft, border);
- putCharXY(left + boxWidth - 1, top + boxHeight - 1, cBottomRight,
- border);
-
- // Draw the box lines
- hLineXY(left + 1, top, boxWidth - 2, cHSide, border);
- vLineXY(left, top + 1, boxHeight - 2, cVSide, border);
- hLineXY(left + 1, top + boxHeight - 1, boxWidth - 2, cHSide, border);
- vLineXY(left + boxWidth - 1, top + 1, boxHeight - 2, cVSide, border);
-
- // Fill in the interior background
- for (int i = 1; i < boxHeight - 1; i++) {
- hLineXY(1 + left, i + top, boxWidth - 2, ' ', background);
- }
-
- if (shadow) {
- // Draw a shadow
- drawBoxShadow(left, top, right, bottom);
- }
- }
-
- /**
- * Draw a box shadow
+ public final void drawBox(final int left, final int top,
+ final int right, final int bottom,
+ final CellAttributes border, final CellAttributes background,
+ final int borderType, final boolean shadow) {
+
+ int boxTop = top;
+ int boxLeft = left;
+ int boxWidth = right - left;
+ int boxHeight = bottom - top;
+
+ char cTopLeft;
+ char cTopRight;
+ char cBottomLeft;
+ char cBottomRight;
+ char cHSide;
+ char cVSide;
+
+ switch (borderType) {
+ case 1:
+ cTopLeft = GraphicsChars.ULCORNER;
+ cTopRight = GraphicsChars.URCORNER;
+ cBottomLeft = GraphicsChars.LLCORNER;
+ cBottomRight = GraphicsChars.LRCORNER;
+ cHSide = GraphicsChars.SINGLE_BAR;
+ cVSide = GraphicsChars.WINDOW_SIDE;
+ break;
+
+ case 2:
+ cTopLeft = GraphicsChars.WINDOW_LEFT_TOP_DOUBLE;
+ cTopRight = GraphicsChars.WINDOW_RIGHT_TOP_DOUBLE;
+ cBottomLeft = GraphicsChars.WINDOW_LEFT_BOTTOM_DOUBLE;
+ cBottomRight = GraphicsChars.WINDOW_RIGHT_BOTTOM_DOUBLE;
+ cHSide = GraphicsChars.DOUBLE_BAR;
+ cVSide = GraphicsChars.WINDOW_SIDE_DOUBLE;
+ break;
+
+ case 3:
+ cTopLeft = GraphicsChars.WINDOW_LEFT_TOP;
+ cTopRight = GraphicsChars.WINDOW_RIGHT_TOP;
+ cBottomLeft = GraphicsChars.WINDOW_LEFT_BOTTOM;
+ cBottomRight = GraphicsChars.WINDOW_RIGHT_BOTTOM;
+ cHSide = GraphicsChars.WINDOW_TOP;
+ cVSide = GraphicsChars.WINDOW_SIDE;
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid border type: "
+ + borderType);
+ }
+
+ // Place the corner characters
+ putCharXY(left, top, cTopLeft, border);
+ putCharXY(left + boxWidth - 1, top, cTopRight, border);
+ putCharXY(left, top + boxHeight - 1, cBottomLeft, border);
+ putCharXY(left + boxWidth - 1, top + boxHeight - 1, cBottomRight,
+ border);
+
+ // Draw the box lines
+ hLineXY(left + 1, top, boxWidth - 2, cHSide, border);
+ vLineXY(left, top + 1, boxHeight - 2, cVSide, border);
+ hLineXY(left + 1, top + boxHeight - 1, boxWidth - 2, cHSide, border);
+ vLineXY(left + boxWidth - 1, top + 1, boxHeight - 2, cVSide, border);
+
+ // Fill in the interior background
+ for (int i = 1; i < boxHeight - 1; i++) {
+ hLineXY(1 + left, i + top, boxWidth - 2, ' ', background);
+ }
+
+ if (shadow) {
+ // Draw a shadow
+ drawBoxShadow(left, top, right, bottom);
+ }
+ }
+
+ /**
+ * Draw a box shadow.