2 * Jexer - Java Text User Interface
4 * The MIT License (MIT)
6 * Copyright (C) 2016 Kevin Lamonte
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
31 import java
.util
.HashSet
;
33 import jexer
.bits
.Cell
;
34 import jexer
.bits
.CellAttributes
;
35 import jexer
.bits
.GraphicsChars
;
36 import jexer
.event
.TCommandEvent
;
37 import jexer
.event
.TKeypressEvent
;
38 import jexer
.event
.TMenuEvent
;
39 import jexer
.event
.TMouseEvent
;
40 import jexer
.event
.TResizeEvent
;
41 import jexer
.io
.Screen
;
42 import jexer
.menu
.TMenu
;
43 import static jexer
.TCommand
.*;
44 import static jexer
.TKeypress
.*;
47 * TWindow is the top-level container and drawing surface for other widgets.
49 public class TWindow
extends TWidget
{
52 * Window's parent TApplication.
54 private TApplication application
;
57 * Get this TWindow's parent TApplication.
59 * @return this TWindow's parent TApplication
62 public final TApplication
getApplication() {
72 public final Screen
getScreen() {
73 return application
.getScreen();
79 private String title
= "";
84 * @return window title
86 public final String
getTitle() {
93 * @param title new window title
95 public final void setTitle(final String title
) {
100 * Window is resizable (default yes).
102 public static final int RESIZABLE
= 0x01;
105 * Window is modal (default no).
107 public static final int MODAL
= 0x02;
110 * Window is centered (default no).
112 public static final int CENTERED
= 0x04;
117 private int flags
= RESIZABLE
;
120 * Z order. Lower number means more in-front.
125 * Get Z order. Lower number means more in-front.
127 * @return Z value. Lower number means more in-front.
129 public final int getZ() {
134 * Set Z order. Lower number means more in-front.
136 * @param z the new Z value. Lower number means more in-front.
138 public final void setZ(final int z
) {
143 * Window's keyboard shortcuts. Any key in this set will be passed to
144 * the window directly rather than processed through the menu
147 private HashSet
<TKeypress
> keyboardShortcuts
= new HashSet
<TKeypress
>();
150 * Add a keypress to be overridden for this window.
152 * @param key the key to start taking control of
154 protected void addShortcutKeypress(final TKeypress key
) {
155 keyboardShortcuts
.add(key
);
159 * Remove a keypress to be overridden for this window.
161 * @param key the key to stop taking control of
163 protected void removeShortcutKeypress(final TKeypress key
) {
164 keyboardShortcuts
.remove(key
);
168 * Remove all keypresses to be overridden for this window.
170 protected void clearShortcutKeypresses() {
171 keyboardShortcuts
.clear();
175 * Determine if a keypress is overridden for this window.
177 * @param key the key to check
178 * @return true if this window wants to process this key on its own
180 public boolean isShortcutKeypress(final TKeypress key
) {
181 return keyboardShortcuts
.contains(key
);
185 * If true, then the user clicked on the title bar and is moving the
188 protected boolean inWindowMove
= false;
191 * If true, then the user clicked on the bottom right corner and is
192 * resizing the window.
194 protected boolean inWindowResize
= false;
197 * If true, then the user selected "Size/Move" (or hit Ctrl-F5) and is
198 * resizing/moving the window via the keyboard.
200 private boolean inKeyboardResize
= false;
203 * If true, this window is maximized.
205 private boolean maximized
= false;
208 * Remember mouse state.
210 protected TMouseEvent mouse
;
212 // For moving the window. resizing also uses moveWindowMouseX/Y
213 private int moveWindowMouseX
;
214 private int moveWindowMouseY
;
215 private int oldWindowX
;
216 private int oldWindowY
;
219 private int resizeWindowWidth
;
220 private int resizeWindowHeight
;
221 private int minimumWindowWidth
= 10;
222 private int minimumWindowHeight
= 2;
223 private int maximumWindowWidth
= -1;
224 private int maximumWindowHeight
= -1;
226 // For maximize/restore
227 private int restoreWindowWidth
;
228 private int restoreWindowHeight
;
229 private int restoreWindowX
;
230 private int restoreWindowY
;
233 * Set the maximum width for this window.
235 * @param maximumWindowWidth new maximum width
237 public final void setMaximumWindowWidth(final int maximumWindowWidth
) {
238 this.maximumWindowWidth
= maximumWindowWidth
;
242 * Public constructor. Window will be located at (0, 0).
244 * @param application TApplication that manages this window
245 * @param title window title, will be centered along the top border
246 * @param width width of window
247 * @param height height of window
249 public TWindow(final TApplication application
, final String title
,
250 final int width
, final int height
) {
252 this(application
, title
, 0, 0, width
, height
, RESIZABLE
);
256 * Public constructor. Window will be located at (0, 0).
258 * @param application TApplication that manages this window
259 * @param title window title, will be centered along the top border
260 * @param width width of window
261 * @param height height of window
262 * @param flags bitmask of RESIZABLE, CENTERED, or MODAL
264 public TWindow(final TApplication application
, final String title
,
265 final int width
, final int height
, final int flags
) {
267 this(application
, title
, 0, 0, width
, height
, flags
);
271 * Public constructor.
273 * @param application TApplication that manages this window
274 * @param title window title, will be centered along the top border
275 * @param x column relative to parent
276 * @param y row relative to parent
277 * @param width width of window
278 * @param height height of window
280 public TWindow(final TApplication application
, final String title
,
281 final int x
, final int y
, final int width
, final int height
) {
283 this(application
, title
, x
, y
, width
, height
, RESIZABLE
);
287 * Public constructor.
289 * @param application TApplication that manages this window
290 * @param title window title, will be centered along the top border
291 * @param x column relative to parent
292 * @param y row relative to parent
293 * @param width width of window
294 * @param height height of window
295 * @param flags mask of RESIZABLE, CENTERED, or MODAL
297 public TWindow(final TApplication application
, final String title
,
298 final int x
, final int y
, final int width
, final int height
,
303 // I am my own window and parent
304 setupForTWindow(this, x
, y
+ application
.getDesktopTop(),
309 this.application
= application
;
312 // Minimum width/height are 10 and 2
313 assert (width
>= 10);
314 assert (getHeight() >= 2);
316 // MODAL implies CENTERED
318 this.flags
|= CENTERED
;
321 // Center window if specified
324 // Add me to the application
325 application
.addWindow(this);
329 * Recenter the window on-screen.
331 public final void center() {
332 if ((flags
& CENTERED
) != 0) {
333 if (getWidth() < getScreen().getWidth()) {
334 setX((getScreen().getWidth() - getWidth()) / 2);
338 setY(((application
.getDesktopBottom()
339 - application
.getDesktopTop()) - getHeight()) / 2);
343 setY(getY() + application
.getDesktopTop());
348 * Returns true if this window is modal.
350 * @return true if this window is modal
352 public final boolean isModal() {
353 if ((flags
& MODAL
) == 0) {
360 * Returns true if the mouse is currently on the close button.
362 * @return true if mouse is currently on the close button
364 private boolean mouseOnClose() {
366 && (mouse
.getAbsoluteY() == getY())
367 && (mouse
.getAbsoluteX() == getX() + 3)
375 * Returns true if the mouse is currently on the maximize/restore button.
377 * @return true if the mouse is currently on the maximize/restore button
379 private boolean mouseOnMaximize() {
382 && (mouse
.getAbsoluteY() == getY())
383 && (mouse
.getAbsoluteX() == getX() + getWidth() - 4)
391 * Returns true if the mouse is currently on the resizable lower right
394 * @return true if the mouse is currently on the resizable lower right
397 private boolean mouseOnResize() {
398 if (((flags
& RESIZABLE
) != 0)
401 && (mouse
.getAbsoluteY() == getY() + getHeight() - 1)
402 && ((mouse
.getAbsoluteX() == getX() + getWidth() - 1)
403 || (mouse
.getAbsoluteX() == getX() + getWidth() - 2))
411 * Retrieve the background color.
413 * @return the background color
415 public final CellAttributes
getBackground() {
417 && (inWindowMove
|| inWindowResize
|| inKeyboardResize
)
420 return getTheme().getColor("twindow.background.windowmove");
421 } else if (isModal() && inWindowMove
) {
423 return getTheme().getColor("twindow.background.modal");
424 } else if (isModal()) {
426 return getTheme().getColor("twindow.background.modal");
428 return getTheme().getColor("twindow.background.modal.inactive");
429 } else if (isActive()) {
431 return getTheme().getColor("twindow.background");
434 return getTheme().getColor("twindow.background.inactive");
439 * Retrieve the border color.
441 * @return the border color
443 public CellAttributes
getBorder() {
445 && (inWindowMove
|| inWindowResize
|| inKeyboardResize
)
448 return getTheme().getColor("twindow.border.windowmove");
449 } else if (isModal() && inWindowMove
) {
451 return getTheme().getColor("twindow.border.modal.windowmove");
452 } else if (isModal()) {
454 return getTheme().getColor("twindow.border.modal");
456 return getTheme().getColor("twindow.border.modal.inactive");
458 } else if (isActive()) {
460 return getTheme().getColor("twindow.border");
463 return getTheme().getColor("twindow.border.inactive");
468 * Retrieve the border line type.
470 * @return the border line type
472 private int getBorderType() {
474 && (inWindowMove
|| inWindowResize
|| inKeyboardResize
)
478 } else if (isModal() && inWindowMove
) {
481 } else if (isModal()) {
487 } else if (isActive()) {
495 * Subclasses should override this method to cleanup resources. This is
496 * called by application.closeWindow().
498 public void onClose() {
499 // Default: do nothing
503 * Called by application.switchWindow() when this window gets the
504 * focus, and also by application.addWindow().
506 public void onFocus() {
507 // Default: do nothing
511 * Called by application.switchWindow() when another window gets the
514 public void onUnfocus() {
515 // Default: do nothing
519 * Called by TApplication.drawChildren() to render on screen.
523 // Draw the box and background first.
524 CellAttributes border
= getBorder();
525 CellAttributes background
= getBackground();
526 int borderType
= getBorderType();
528 getScreen().drawBox(0, 0, getWidth(), getHeight(), border
,
529 background
, borderType
, true);
532 int titleLeft
= (getWidth() - title
.length() - 2) / 2;
533 putCharXY(titleLeft
, 0, ' ', border
);
534 putStringXY(titleLeft
+ 1, 0, title
);
535 putCharXY(titleLeft
+ title
.length() + 1, 0, ' ', border
);
539 // Draw the close button
540 putCharXY(2, 0, '[', border
);
541 putCharXY(4, 0, ']', border
);
542 if (mouseOnClose() && mouse
.isMouse1()) {
543 putCharXY(3, 0, GraphicsChars
.CP437
[0x0F],
545 ?
getTheme().getColor("twindow.border.windowmove")
546 : getTheme().getColor("twindow.border.modal.windowmove"));
548 putCharXY(3, 0, GraphicsChars
.CP437
[0xFE],
550 ?
getTheme().getColor("twindow.border.windowmove")
551 : getTheme().getColor("twindow.border.modal.windowmove"));
554 // Draw the maximize button
557 putCharXY(getWidth() - 5, 0, '[', border
);
558 putCharXY(getWidth() - 3, 0, ']', border
);
559 if (mouseOnMaximize() && mouse
.isMouse1()) {
560 putCharXY(getWidth() - 4, 0, GraphicsChars
.CP437
[0x0F],
561 getTheme().getColor("twindow.border.windowmove"));
564 putCharXY(getWidth() - 4, 0, GraphicsChars
.CP437
[0x12],
565 getTheme().getColor("twindow.border.windowmove"));
567 putCharXY(getWidth() - 4, 0, GraphicsChars
.UPARROW
,
568 getTheme().getColor("twindow.border.windowmove"));
572 // Draw the resize corner
573 if ((flags
& RESIZABLE
) != 0) {
574 putCharXY(getWidth() - 2, getHeight() - 1,
575 GraphicsChars
.SINGLE_BAR
,
576 getTheme().getColor("twindow.border.windowmove"));
577 putCharXY(getWidth() - 1, getHeight() - 1,
578 GraphicsChars
.LRCORNER
,
579 getTheme().getColor("twindow.border.windowmove"));
586 * Handle mouse button presses.
588 * @param mouse mouse button event
591 public void onMouseDown(final TMouseEvent mouse
) {
594 inKeyboardResize
= false;
596 if ((mouse
.getAbsoluteY() == getY())
598 && (getX() <= mouse
.getAbsoluteX())
599 && (mouse
.getAbsoluteX() < getX() + getWidth())
601 && !mouseOnMaximize()
603 // Begin moving window
605 moveWindowMouseX
= mouse
.getAbsoluteX();
606 moveWindowMouseY
= mouse
.getAbsoluteY();
614 if (mouseOnResize()) {
615 // Begin window resize
616 inWindowResize
= true;
617 moveWindowMouseX
= mouse
.getAbsoluteX();
618 moveWindowMouseY
= mouse
.getAbsoluteY();
619 resizeWindowWidth
= getWidth();
620 resizeWindowHeight
= getHeight();
627 // I didn't take it, pass it on to my children
628 super.onMouseDown(mouse
);
634 private void maximize() {
635 restoreWindowWidth
= getWidth();
636 restoreWindowHeight
= getHeight();
637 restoreWindowX
= getX();
638 restoreWindowY
= getY();
639 setWidth(getScreen().getWidth());
640 setHeight(application
.getDesktopBottom() - 1);
647 * Restote (unmaximize) window.
649 private void restore() {
650 setWidth(restoreWindowWidth
);
651 setHeight(restoreWindowHeight
);
652 setX(restoreWindowX
);
653 setY(restoreWindowY
);
658 * Handle mouse button releases.
660 * @param mouse mouse button release event
663 public void onMouseUp(final TMouseEvent mouse
) {
666 if ((inWindowMove
) && (mouse
.isMouse1())) {
667 // Stop moving window
668 inWindowMove
= false;
672 if ((inWindowResize
) && (mouse
.isMouse1())) {
673 // Stop resizing window
674 inWindowResize
= false;
678 if (mouse
.isMouse1() && mouseOnClose()) {
680 application
.closeWindow(this);
684 if ((mouse
.getAbsoluteY() == getY())
686 && mouseOnMaximize()) {
694 // Pass a resize event to my children
695 onResize(new TResizeEvent(TResizeEvent
.Type
.WIDGET
,
696 getWidth(), getHeight()));
700 // I didn't take it, pass it on to my children
701 super.onMouseUp(mouse
);
705 * Handle mouse movements.
707 * @param mouse mouse motion event
710 public void onMouseMotion(final TMouseEvent mouse
) {
715 setX(oldWindowX
+ (mouse
.getAbsoluteX() - moveWindowMouseX
));
716 setY(oldWindowY
+ (mouse
.getAbsoluteY() - moveWindowMouseY
));
717 // Don't cover up the menu bar
718 if (getY() < application
.getDesktopTop()) {
719 setY(application
.getDesktopTop());
724 if (inWindowResize
) {
726 setWidth(resizeWindowWidth
+ (mouse
.getAbsoluteX()
727 - moveWindowMouseX
));
728 setHeight(resizeWindowHeight
+ (mouse
.getAbsoluteY()
729 - moveWindowMouseY
));
730 if (getX() + getWidth() > getScreen().getWidth()) {
731 setWidth(getScreen().getWidth() - getX());
733 if (getY() + getHeight() > application
.getDesktopBottom()) {
734 setY(application
.getDesktopBottom() - getHeight() + 1);
736 // Don't cover up the menu bar
737 if (getY() < application
.getDesktopTop()) {
738 setY(application
.getDesktopTop());
741 // Keep within min/max bounds
742 if (getWidth() < minimumWindowWidth
) {
743 setWidth(minimumWindowWidth
);
744 inWindowResize
= false;
746 if (getHeight() < minimumWindowHeight
) {
747 setHeight(minimumWindowHeight
);
748 inWindowResize
= false;
750 if ((maximumWindowWidth
> 0)
751 && (getWidth() > maximumWindowWidth
)
753 setWidth(maximumWindowWidth
);
754 inWindowResize
= false;
756 if ((maximumWindowHeight
> 0)
757 && (getHeight() > maximumWindowHeight
)
759 setHeight(maximumWindowHeight
);
760 inWindowResize
= false;
763 // Pass a resize event to my children
764 onResize(new TResizeEvent(TResizeEvent
.Type
.WIDGET
,
765 getWidth(), getHeight()));
769 // I didn't take it, pass it on to my children
770 super.onMouseMotion(mouse
);
776 * @param keypress keystroke event
779 public void onKeypress(final TKeypressEvent keypress
) {
781 if (inKeyboardResize
) {
783 // ESC or ENTER - Exit size/move
784 if (keypress
.equals(kbEsc
) || keypress
.equals(kbEnter
)) {
785 inKeyboardResize
= false;
788 if (keypress
.equals(kbLeft
)) {
793 if (keypress
.equals(kbRight
)) {
794 if (getX() < getScreen().getWidth() - 1) {
798 if (keypress
.equals(kbDown
)) {
799 if (getY() < application
.getDesktopBottom() - 1) {
803 if (keypress
.equals(kbUp
)) {
808 if (keypress
.equals(kbShiftLeft
)) {
809 if ((getWidth() > minimumWindowWidth
)
810 || (minimumWindowWidth
<= 0)
812 setWidth(getWidth() - 1);
815 if (keypress
.equals(kbShiftRight
)) {
816 if ((getWidth() < maximumWindowWidth
)
817 || (maximumWindowWidth
<= 0)
819 setWidth(getWidth() + 1);
822 if (keypress
.equals(kbShiftUp
)) {
823 if ((getHeight() > minimumWindowHeight
)
824 || (minimumWindowHeight
<= 0)
826 setHeight(getHeight() - 1);
829 if (keypress
.equals(kbShiftDown
)) {
830 if ((getHeight() < maximumWindowHeight
)
831 || (maximumWindowHeight
<= 0)
833 setHeight(getHeight() + 1);
837 // Pass a resize event to my children
838 onResize(new TResizeEvent(TResizeEvent
.Type
.WIDGET
,
839 getWidth(), getHeight()));
844 // These keystrokes will typically not be seen unless a subclass
845 // overrides onMenu() due to how TApplication dispatches
848 // Ctrl-W - close window
849 if (keypress
.equals(kbCtrlW
)) {
850 application
.closeWindow(this);
854 // F6 - behave like Alt-TAB
855 if (keypress
.equals(kbF6
)) {
856 application
.switchWindow(true);
860 // Shift-F6 - behave like Shift-Alt-TAB
861 if (keypress
.equals(kbShiftF6
)) {
862 application
.switchWindow(false);
867 if (keypress
.equals(kbF5
)) {
875 // Ctrl-F5 - size/move
876 if (keypress
.equals(kbCtrlF5
)) {
877 inKeyboardResize
= !inKeyboardResize
;
880 // I didn't take it, pass it on to my children
881 super.onKeypress(keypress
);
885 * Handle posted command events.
887 * @param command command event
890 public void onCommand(final TCommandEvent command
) {
892 // These commands will typically not be seen unless a subclass
893 // overrides onMenu() due to how TApplication dispatches
896 if (command
.equals(cmWindowClose
)) {
897 application
.closeWindow(this);
901 if (command
.equals(cmWindowNext
)) {
902 application
.switchWindow(true);
906 if (command
.equals(cmWindowPrevious
)) {
907 application
.switchWindow(false);
911 if (command
.equals(cmWindowMove
)) {
912 inKeyboardResize
= true;
916 if (command
.equals(cmWindowZoom
)) {
924 // I didn't take it, pass it on to my children
925 super.onCommand(command
);
929 * Handle posted menu events.
931 * @param menu menu event
934 public void onMenu(final TMenuEvent menu
) {
935 if (menu
.getId() == TMenu
.MID_WINDOW_CLOSE
) {
936 application
.closeWindow(this);
940 if (menu
.getId() == TMenu
.MID_WINDOW_NEXT
) {
941 application
.switchWindow(true);
945 if (menu
.getId() == TMenu
.MID_WINDOW_PREVIOUS
) {
946 application
.switchWindow(false);
950 if (menu
.getId() == TMenu
.MID_WINDOW_MOVE
) {
951 inKeyboardResize
= true;
955 if (menu
.getId() == TMenu
.MID_WINDOW_ZOOM
) {
964 // I didn't take it, pass it on to my children
968 // ------------------------------------------------------------------------
969 // Passthru for Screen functions ------------------------------------------
970 // ------------------------------------------------------------------------
973 * Get the attributes at one location.
975 * @param x column coordinate. 0 is the left-most column.
976 * @param y row coordinate. 0 is the top-most row.
977 * @return attributes at (x, y)
979 public final CellAttributes
getAttrXY(final int x
, final int y
) {
980 return getScreen().getAttrXY(x
, y
);
984 * Set the attributes at one location.
986 * @param x column coordinate. 0 is the left-most column.
987 * @param y row coordinate. 0 is the top-most row.
988 * @param attr attributes to use (bold, foreColor, backColor)
990 public final void putAttrXY(final int x
, final int y
,
991 final CellAttributes attr
) {
993 getScreen().putAttrXY(x
, y
, attr
);
997 * Set the attributes at one location.
999 * @param x column coordinate. 0 is the left-most column.
1000 * @param y row coordinate. 0 is the top-most row.
1001 * @param attr attributes to use (bold, foreColor, backColor)
1002 * @param clip if true, honor clipping/offset
1004 public final void putAttrXY(final int x
, final int y
,
1005 final CellAttributes attr
, final boolean clip
) {
1007 getScreen().putAttrXY(x
, y
, attr
, clip
);
1011 * Fill the entire screen with one character with attributes.
1013 * @param ch character to draw
1014 * @param attr attributes to use (bold, foreColor, backColor)
1016 public final void putAll(final char ch
, final CellAttributes attr
) {
1017 getScreen().putAll(ch
, attr
);
1021 * Render one character with attributes.
1023 * @param x column coordinate. 0 is the left-most column.
1024 * @param y row coordinate. 0 is the top-most row.
1025 * @param ch character + attributes to draw
1027 public final void putCharXY(final int x
, final int y
, final Cell ch
) {
1028 getScreen().putCharXY(x
, y
, ch
);
1032 * Render one character with attributes.
1034 * @param x column coordinate. 0 is the left-most column.
1035 * @param y row coordinate. 0 is the top-most row.
1036 * @param ch character to draw
1037 * @param attr attributes to use (bold, foreColor, backColor)
1039 public final void putCharXY(final int x
, final int y
, final char ch
,
1040 final CellAttributes attr
) {
1042 getScreen().putCharXY(x
, y
, ch
, attr
);
1046 * Render one character without changing the underlying attributes.
1048 * @param x column coordinate. 0 is the left-most column.
1049 * @param y row coordinate. 0 is the top-most row.
1050 * @param ch character to draw
1052 public final void putCharXY(final int x
, final int y
, final char ch
) {
1053 getScreen().putCharXY(x
, y
, ch
);
1057 * Render a string. Does not wrap if the string exceeds the line.
1059 * @param x column coordinate. 0 is the left-most column.
1060 * @param y row coordinate. 0 is the top-most row.
1061 * @param str string to draw
1062 * @param attr attributes to use (bold, foreColor, backColor)
1064 public final void putStringXY(final int x
, final int y
, final String str
,
1065 final CellAttributes attr
) {
1067 getScreen().putStringXY(x
, y
, str
, attr
);
1071 * Render a string without changing the underlying attribute. Does not
1072 * wrap if the string exceeds the line.
1074 * @param x column coordinate. 0 is the left-most column.
1075 * @param y row coordinate. 0 is the top-most row.
1076 * @param str string to draw
1078 public final void putStringXY(final int x
, final int y
, final String str
) {
1079 getScreen().putStringXY(x
, y
, str
);
1083 * Draw a vertical line from (x, y) to (x, y + n).
1085 * @param x column coordinate. 0 is the left-most column.
1086 * @param y row coordinate. 0 is the top-most row.
1087 * @param n number of characters to draw
1088 * @param ch character to draw
1089 * @param attr attributes to use (bold, foreColor, backColor)
1091 public final void vLineXY(final int x
, final int y
, final int n
,
1092 final char ch
, final CellAttributes attr
) {
1094 getScreen().vLineXY(x
, y
, n
, ch
, attr
);
1098 * Draw a horizontal line from (x, y) to (x + n, y).
1100 * @param x column coordinate. 0 is the left-most column.
1101 * @param y row coordinate. 0 is the top-most row.
1102 * @param n number of characters to draw
1103 * @param ch character to draw
1104 * @param attr attributes to use (bold, foreColor, backColor)
1106 public final void hLineXY(final int x
, final int y
, final int n
,
1107 final char ch
, final CellAttributes attr
) {
1109 getScreen().hLineXY(x
, y
, n
, ch
, attr
);