import jexer.bits.CellAttributes;
import jexer.bits.MnemonicString;
+import jexer.bits.StringUtils;
/**
* TLabel implements a simple label, with an optional mnemonic hotkey action
final TAction action) {
// Set parent and window
- super(parent, false, x, y, text.length(), 1);
+ super(parent, false, x, y, StringUtils.width(text), 1);
mnemonic = new MnemonicString(text);
this.colorKey = colorKey;
mnemonicColor.setBackColor(background.getBackColor());
}
putStringXY(0, 0, mnemonic.getRawLabel(), color);
- if (mnemonic.getShortcutIdx() >= 0) {
- putCharXY(mnemonic.getShortcutIdx(), 0,
+ if (mnemonic.getScreenShortcutIdx() >= 0) {
+ putCharXY(mnemonic.getScreenShortcutIdx(), 0,
mnemonic.getShortcut(), mnemonicColor);
}
}
mnemonic = new MnemonicString(label);
}
+ /**
+ * Get the label color.
+ *
+ * @return the ColorTheme key color to use for foreground text
+ */
+ public String getColorKey() {
+ return colorKey;
+ }
+
+ /**
+ * Set the label color.
+ *
+ * @param colorKey ColorTheme key color to use for foreground text
+ */
+ public void setColorKey(final String colorKey) {
+ this.colorKey = colorKey;
+ }
+
/**
* Act as though the mnemonic shortcut was pressed.
*/