List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Align RIGHT
int RIGHT
To view the source code for com.badlogic.gdx.scenes.scene2d.ui Align RIGHT.
Click Source Link
From source file:com.gsn.engine.template.GsnLabel.java
License:Apache License
/** @param labelAlign Aligns all the text with the label widget. * @param lineAlign Aligns each line of text (left, right, or center). * @see Align *///w w w . j av a 2 s . c o m public void setAlignment(int labelAlign, int lineAlign) { this.labelAlign = labelAlign; if ((lineAlign & Align.LEFT) != 0) this.lineAlign = HAlignment.LEFT; else if ((lineAlign & Align.RIGHT) != 0) this.lineAlign = HAlignment.RIGHT; else this.lineAlign = HAlignment.CENTER; invalidate(); }
From source file:com.gsn.engine.template.GsnLabel.java
License:Apache License
@Override public void layout() { computeBounds();/* w ww . j a va2s . c om*/ if (wrap) { float prefHeight = getPrefHeight(); if (prefHeight != lastPrefHeight) { lastPrefHeight = prefHeight; invalidateHierarchy(); } } float y; if ((labelAlign & Align.TOP) != 0) { y = cache.getFont().isFlipped() ? 0 : height - bounds.height; y += style.font.getDescent(); } else if ((labelAlign & Align.BOTTOM) != 0) { y = cache.getFont().isFlipped() ? height - bounds.height : 0; y -= style.font.getDescent(); } else y = (height - bounds.height) / 2; if (!cache.getFont().isFlipped()) y += bounds.height; float x; if ((labelAlign & Align.LEFT) != 0) x = 0; else if ((labelAlign & Align.RIGHT) != 0) { x = width - bounds.width; } else x = (width - bounds.width) / 2; if (wrap) cache.setWrappedText(text, x, y, bounds.width, lineAlign); else cache.setMultiLineText(text, x, y, bounds.width, lineAlign); }