Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Cell#width()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Cell#width() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TooltipLmlAttribute.java    From gdx-texture-packer-gui with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 2
Source File: CellWidget.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private void applySizeData (final Cell<?> cell) {
	if (width > IGNORED_SIZE) {
		cell.width(width);
	}
	if (height > IGNORED_SIZE) {
		cell.height(height);
	}
	if (minWidth > IGNORED_SIZE) {
		cell.minWidth(minWidth);
	}
	if (minHeight > IGNORED_SIZE) {
		cell.minHeight(minHeight);
	}
}
 
Example 3
Source File: PagedScrollPane.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void setWidth (float width) {
	super.setWidth(width);
	if (content != null) {
		for (Cell<?> cell : content.getCells()) {
			cell.width(width);
		}
		content.invalidate();
	}
}