+ // Pass on to TWidget.
+ super.onResize(resize);
+ }
+
+ // ------------------------------------------------------------------------
+ // TWidget ----------------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get this TWindow's parent TApplication.
+ *
+ * @return this TWindow's parent TApplication
+ */
+ @Override
+ public final TApplication getApplication() {
+ return application;
+ }
+
+ /**
+ * Get the Screen.
+ *
+ * @return the Screen
+ */
+ @Override
+ public final Screen getScreen() {
+ return application.getScreen();
+ }
+
+ /**
+ * Called by TApplication.drawChildren() to render on screen.
+ */
+ @Override
+ public void draw() {
+ // Draw the box and background first.
+ CellAttributes border = getBorder();
+ CellAttributes background = getBackground();
+ int borderType = getBorderType();
+
+ drawBox(0, 0, getWidth(), getHeight(), border, background, borderType,
+ true);
+
+ // Draw the title
+ int titleLength = StringUtils.width(title);
+ int titleLeft = (getWidth() - titleLength - 2) / 2;
+ putCharXY(titleLeft, 0, ' ', border);
+ putStringXY(titleLeft + 1, 0, title, border);
+ putCharXY(titleLeft + titleLength + 1, 0, ' ', border);
+
+ if (isActive()) {
+
+ // Draw the close button
+ if ((flags & NOCLOSEBOX) == 0) {
+ putCharXY(2, 0, '[', border);
+ putCharXY(4, 0, ']', border);
+ if (mouseOnClose() && mouse.isMouse1()) {
+ putCharXY(3, 0, GraphicsChars.CP437[0x0F],
+ getBorderControls());
+ } else {
+ putCharXY(3, 0, GraphicsChars.CP437[0xFE],
+ getBorderControls());
+ }
+ }
+
+ // Draw the maximize button
+ if (!isModal() && ((flags & NOZOOMBOX) == 0)) {
+
+ putCharXY(getWidth() - 5, 0, '[', border);
+ putCharXY(getWidth() - 3, 0, ']', border);
+ if (mouseOnMaximize() && mouse.isMouse1()) {
+ putCharXY(getWidth() - 4, 0, GraphicsChars.CP437[0x0F],
+ getBorderControls());
+ } else {
+ if (maximized) {
+ putCharXY(getWidth() - 4, 0, GraphicsChars.CP437[0x12],
+ getBorderControls());
+ } else {
+ putCharXY(getWidth() - 4, 0, GraphicsChars.UPARROW,
+ getBorderControls());
+ }
+ }
+
+ // Draw the resize corner
+ if ((flags & RESIZABLE) != 0) {
+ putCharXY(getWidth() - 2, getHeight() - 1,
+ GraphicsChars.SINGLE_BAR, getBorderControls());
+ putCharXY(getWidth() - 1, getHeight() - 1,
+ GraphicsChars.LRCORNER, getBorderControls());
+ }
+ }