X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=c89e70ec65de92a7240ec9c69e90bcbf7736da4a;hb=382bc294dd88b71639fdd6c73216d2519635a080;hp=f7a83a193620fa1350bc3905291cd2c2c5815523;hpb=00691e80f2f135f92be739e2b7e86775a2357276;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index f7a83a1..c89e70e 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -28,6 +28,7 @@ */ package jexer; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.List; import java.util.ArrayList; @@ -1116,6 +1117,7 @@ public abstract class TWidget implements Comparable { // Draw me draw(); + assert (visible == true); // Continue down the chain. Draw the active child last so that it // is on top. @@ -2200,4 +2202,58 @@ public abstract class TWidget implements Comparable { moveAction); } + /** + * Convenience function to add an image to this container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param width number of text cells for width of the image + * @param height number of text cells for height of the image + * @param image the image to display + * @param left left column of the image. 0 is the left-most column. + * @param top top row of the image. 0 is the top-most row. + */ + public final TImage addImage(final int x, final int y, + final int width, final int height, + final BufferedImage image, final int left, final int top) { + + return new TImage(this, x, y, width, height, image, left, top); + } + + /** + * Convenience function to add an image to this container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param width number of text cells for width of the image + * @param height number of text cells for height of the image + * @param image the image to display + * @param left left column of the image. 0 is the left-most column. + * @param top top row of the image. 0 is the top-most row. + * @param clickAction function to call when mouse is pressed + */ + public final TImage addImage(final int x, final int y, + final int width, final int height, + final BufferedImage image, final int left, final int top, + final TAction clickAction) { + + return new TImage(this, x, y, width, height, image, left, top, + clickAction); + } + + /** + * Convenience function to add an editable 2D data table to this + * container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param width width of widget + * @param height height of widget + */ + public TTableWidget addTable(final int x, final int y, final int width, + final int height) { + + return new TTableWidget(this, x, y, width, height); + } + }