X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTLabel.java;h=fb00ac47599a5379127f12a41edc915d5b341f3c;hb=8582f35a3ffb8212463076217eb89278f42331d4;hp=15d6376d5313adff2010b8e5fd559f8a2b15fdd0;hpb=30d336cc33e26af877f7950b93f3b77d9c3a3bd3;p=fanfix.git diff --git a/src/jexer/TLabel.java b/src/jexer/TLabel.java index 15d6376..fb00ac4 100644 --- a/src/jexer/TLabel.java +++ b/src/jexer/TLabel.java @@ -1,4 +1,4 @@ -/** +/* * Jexer - Java Text User Interface * * License: LGPLv3 or later @@ -40,7 +40,25 @@ public final class TLabel extends TWidget { /** * Label text. */ - private String text = ""; + private String label = ""; + + /** + * Get label text. + * + * @return label text + */ + public String getLabel() { + return label; + } + + /** + * Set label text. + * + * @param label new label text + */ + public void setLabel(final String label) { + this.label = label; + } /** * Label color. @@ -74,13 +92,9 @@ public final class TLabel extends TWidget { final int y, final String colorKey) { // Set parent and window - super(parent, false); + super(parent, false, x, y, text.length(), 1); - this.text = text; - setX(x); - setY(y); - setHeight(1); - setWidth(text.length()); + this.label = text; this.colorKey = colorKey; } @@ -94,7 +108,7 @@ public final class TLabel extends TWidget { CellAttributes background = getWindow().getBackground(); color.setBackColor(background.getBackColor()); - getScreen().putStrXY(0, 0, text, color); + getScreen().putStringXY(0, 0, label, color); } }