public TextFieldWithLabel(String labelText, int width) { super(); this.width = width; textField = new VisTextField(); label = new VisLabel(labelText); setupUI(); }
public VisLabel (CharSequence text, Color textColor) { super(text, VisUI.getSkin()); setColor(textColor); }
public void setLabelText (String text) { name.setText(text); }
public Builder (String text, int textAlign) { VisLabel label = new VisLabel(text); label.setAlignment(textAlign); this.content = label; }
/** * Changes text tooltip to specified text. If tooltip content is not instance of VisLabel then previous tooltip content * will be replaced by VisLabel instance. * @param text next tooltip text */ public void setText (String text) { if (content instanceof VisLabel) { ((VisLabel) content).setText(text); } else { setContent(new VisLabel(text)); } pack(); }
setTouchable(Touchable.enabled); VisLabel name = new VisLabel(metadata.name(), viewMode == ViewMode.SMALL_ICONS ? "small" : "default"); name.setEllipsis(true); Drawable icon = iconProvider.provideIcon(this); add(name).minWidth(1).growX().padRight(10); VisLabel size = new VisLabel(isDirectory() ? "" : metadata.readableFileSize(), "small"); VisLabel dateLabel = new VisLabel(dateFormat.format(metadata.lastModified()), "small"); size.setAlignment(Align.right); maxDateLabelWidth = Math.max(dateLabel.getWidth(), maxDateLabelWidth); add(size).right().padRight(isDirectory() ? 0 : 10); add(dateLabel).padRight(6).width(new Value() {
@Override public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) { VisLabel lblText = new VisLabel(parser.parseString(rawAttributeData, actor)); lblText.setAlignment(Align.center); boolean needLineWrap = lblText.getPrefWidth() > LINE_WRAP_THRESHOLD; if (needLineWrap) { lblText.setWrap(true); } final Tooltip tooltip = new Tooltip(); tooltip.clearChildren(); // Removing empty cell with predefined paddings. Cell<VisLabel> tooltipCell = tooltip.add(lblText).center().pad(0f, 4f, 2f, 4f); if (needLineWrap) { tooltipCell.width(LINE_WRAP_THRESHOLD); } tooltip.pack(); tooltip.setTarget(actor); } }
public ExpandEditTextButton(String text, Style style) { super(style); this.style = style; label = new VisLabel(text, style.labelStyle); label.setAlignment(Align.left); label.setEllipsis(true); labelCell = add(label).growX().left().width(new LabelCellWidthValue()); if (style.expandIcon != null) { Image image = new Image(style.expandIcon); image.setScaling(Scaling.none); expandIconCell = add(image).padLeft(4f); } }
private void processPathText() { if (pathProcessed) return; pathProcessed = true; boolean fileShortened = false; String origFilePath = inputFile.getFileHandle().path(); String filePath = origFilePath; filePath = Scene2dUtils.ellipsisFilePath(filePath, lblName.getStyle().font, lblName.getWidth()); fileShortened = !origFilePath.equals(filePath); filePath = Scene2dUtils.colorizeFilePath(filePath, inputFile.getFileHandle().isDirectory(), "light-grey", "white"); lblName.setText(filePath); // Show tooltip only if displayed file name was shortened tooltip.setTarget(fileShortened ? root : null); tooltip.setText(Scene2dUtils.colorizeFilePath(origFilePath, inputFile.getFileHandle().isDirectory(), "light-grey", "white")); tooltip.setTouchable(Touchable.disabled); } }
lblLog.setAlignment(Align.topLeft); lblLog.setWrap(true); lblLog.setText(log); containerLog.setActor(lblLog);
/** Used only by shortcuts panel */ public ShortcutItem (final File file, String customName, Drawable icon) { this.file = file; name = new VisLabel(customName); name.setEllipsis(true); add(new Image(icon)).padTop(3); Cell<VisLabel> labelCell = add(name).padRight(6); labelCell.width(new Value() { @Override public float get (Actor context) { return mainSplitPane.getFirstWidgetBounds().width - 30; } }); addListener(); }
public void updateFromController() { scBtnInstall.setVisible(moduleController.getStatus() == ExtensionModuleController.Status.NOT_INSTALLED); scBtnUninstall.setVisible(moduleController.getStatus() != ExtensionModuleController.Status.NOT_INSTALLED); scBtnUpdate.setVisible(moduleController.getStatus() == ExtensionModuleController.Status.UPDATE_REQUIRED); lblName.setText(moduleController.getName()); lblDescription.setText(moduleController.getDescription()); Skin skin = interfaceService.getSkin(); switch (moduleController.getStatus()) { case NOT_INSTALLED: frameTable.background(skin.getDrawable("custom/em-item-frame")); lblStatus.setText(localeService.getI18nBundle().get("emRepoStatusNotInstalled")); lblStatus.setColor(skin.getColor("text-grey")); break; case INSTALLED: frameTable.background(skin.getDrawable("custom/em-item-frame-installed")); lblStatus.setText(localeService.getI18nBundle().get("emRepoStatusInstalled")); lblStatus.setColor(skin.getColor("text-green")); break; case UPDATE_REQUIRED: frameTable.background(skin.getDrawable("custom/em-item-frame-outofdate")); lblStatus.setText(localeService.getI18nBundle().get("emRepoStatusUpdateRequired")); lblStatus.setColor(skin.getColor("text-yellow")); break; } }
private void addVisWidgets () { VisLabel label = new VisLabel("label"); final VisLabel labelWithTooltip = new VisLabel("label with tooltip"); labelWithTooltip.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { list.setItems("item 1", "item 2", "item 3", "item 4"); listSpinnerTable.add(new VisLabel("list: ")); listSpinnerTable.add(list); spinnerTable.add(new VisLabel("spinners")).colspan(2).row(); spinnerTable.add(intSpinner); spinnerTable.add(arraySpinner).row(); selectBox.setItems("item 1", "item 2", "item 3", "item 4"); selectorsTable.add(new VisLabel("select box: ")); selectorsTable.add(selectBox); linkTable.add(new VisLabel("link label:")); linkTable.add(new LinkLabel("https://github.com/kotcrab/vis-ui")).row(); linkTable2.add(new VisLabel("link label with custom text:")); linkTable2.add(new LinkLabel("kotcrab's blog", "http://kotcrab.com")).row();
public CharSequence getShortcut () { return shortcutLabel.getText(); }
public void setWrapDetails (boolean wrap) { detailsLabel.setWrap(wrap); }
@Override public LinkLabelStyle getStyle () { return (LinkLabelStyle) super.getStyle(); }
public VisLabel (CharSequence text, int alignment) { this(text); setAlignment(alignment); }