本文整理汇总了Java中com.jme3.font.BitmapFont.VAlign类的典型用法代码示例。如果您正苦于以下问题:Java VAlign类的具体用法?Java VAlign怎么用?Java VAlign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VAlign类属于com.jme3.font.BitmapFont包,在下文中一共展示了VAlign类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultVertical
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public static float getDefaultVertical(int offset, VAlign defaultVertical, BaseScreen screen,
Vector2f windowSize) {
float y = 0;
switch (defaultVertical) {
case Top:
y = offset;
break;
case Bottom:
y = screen.getHeight() - (windowSize == null ? (screen.getHeight() / 2f) : windowSize.y) - offset;
break;
case Center:
y = (int) ((screen.getHeight() - (windowSize == null ? (screen.getHeight() / 2f) : windowSize.y)) / 2.0F);
break;
}
return y;
}
示例2: getWindowPosition
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public static Vector2f getWindowPosition(Preferences pref, BaseScreen screen, String id,
Vector2f defaultWindowSize, int offset, Align defaultHorizontal, VAlign defaultVertical) {
Vector2f windowSize = getWindowSize(pref, screen, id, defaultWindowSize);
float x = Integer.MIN_VALUE;
float y = Integer.MIN_VALUE;
if (id != null) {
x = pref.getFloat(id + PersistentWindow.WINDOW_X, Integer.MIN_VALUE);
y = pref.getFloat(id + PersistentWindow.WINDOW_Y, Integer.MIN_VALUE);
}
if (x == Integer.MIN_VALUE || y == Integer.MIN_VALUE) {
x = ExtrasUtil.getDefaultHorizontal(offset, defaultHorizontal, screen, windowSize);
y = ExtrasUtil.getDefaultVertical(offset, defaultVertical, screen, windowSize);
}
if (x < 0) {
x = 0;
} else if (x + windowSize.x > screen.getWidth()) {
x = screen.getWidth() - windowSize.x;
}
if (y < 0) {
y = 0;
} else if (y + windowSize.y > screen.getHeight()) {
y = screen.getHeight() - windowSize.y;
}
return new Vector2f(x, y);
}
示例3: ClientRow
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public ClientRow(ListView listView) {
super(listView);
setBackground(UIFactory.getUIConfig().getBackground(), true);
setBackgroundColor(UIFactory.getUIConfig().getActiveColor(), true);
setBackgroundVisible(false);
setLayout(Layout.horizontal);
nameLabel = new Text("");
nameLabel.setVerticalAlignment(VAlign.Center);
addressLabel = new Text("");
addressLabel.setVerticalAlignment(VAlign.Center);
actorNameLabel = new Text("");
actorNameLabel.setVerticalAlignment(VAlign.Center);
addView(nameLabel);
addView(addressLabel);
addView(actorNameLabel);
addClickListener(new Listener() {
@Override
public void onClick(UI ui, boolean isPress) {
if (isPress) return;
clientList.setSelected(ClientRow.this);
}
});
}
示例4: setVerticalAlignment
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
/**
* Set vertical alignment. Applicable only when text bound is set.
* @param align
*/
public void setVerticalAlignment(BitmapFont.VAlign align) {
if (block.getTextBox() == null && align != VAlign.Top) {
throw new RuntimeException("Bound is not set");
}
block.setVerticalAlignment(align);
letters.invalidate();
needRefresh = true;
}
示例5: toVAlign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public static VAlign toVAlign(String align) {
if (align.equalsIgnoreCase("middle")) {
return VAlign.Center;
} else if (align.equalsIgnoreCase("bottom")) {
return VAlign.Bottom;
}
return VAlign.Top;
}
示例6: vAlignToIdent
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public static IdentValue vAlignToIdent(BitmapFont.VAlign textVAlign) {
switch (textVAlign) {
case Top:
return IdentValue.TOP;
case Bottom:
return IdentValue.BOTTOM;
default:
return IdentValue.MIDDLE;
}
}
示例7: identToVAlign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public static VAlign identToVAlign(IdentValue ident) {
if (ident == IdentValue.TOP) {
return VAlign.Top;
} else if (ident == IdentValue.BOTTOM) {
return VAlign.Bottom;
}
return VAlign.Center;
}
示例8: setTextVAlign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
/**
* Sets the element's text layer vertical alignment
*
* @param textVAlign
*/
@Override
public BaseElement setTextVAlign(BitmapFont.VAlign textVAlign) {
PropertyDeclaration decl = new PropertyDeclaration(CSSName.VERTICAL_ALIGN,
new PropertyValue(CssUtil.vAlignToIdent(textVAlign)), false, StylesheetInfo.USER);
cssState.addAllCssDeclaration(decl);
applyCss(decl);
layoutChildren();
return this;
}
示例9: calcVAlign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
protected VAlign calcVAlign() {
CascadedStyle style = cssState.getCascadedStyle(false);
if (style != null) {
PropertyDeclaration pv = style.propertyByName(CSSName.VERTICAL_ALIGN);
if (pv != null)
return CssUtil.identToVAlign(pv.asIdentValue());
}
return VAlign.Center;
}
示例10: setTextVAlign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
/**
* Sets the element's text layer vertical alignment
*
* @param textVAlign
*/
public BaseElement setTextVAlign(BitmapFont.VAlign textVAlign) {
this.textVAlign = textVAlign;
if (textElement != null) {
textElement.setTextVAlign(textVAlign);
/*
* Text and children because some components use text align for
* layout of children
*/
dirtyLayout(false, LayoutType.text, LayoutType.children);
}
layoutChildren();
return this;
}
示例11: setValign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public BaseElement setValign(VAlign valign) {
if (!Objects.equals(valign, this.valign)) {
this.valign = valign;
updateNodeLocation();
}
return this;
}
示例12: AbstractChooserDialog
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public AbstractChooserDialog(final BaseScreen screen, String styleId, String title,
ChooserModel<I> resources, Preferences pref, ChooserView<I> view) {
super(screen, styleId, VAlign.Center, Align.Right, null, true, SaveType.SIZE, pref);
this.view = view;
this.resources = resources;
panel = createPanel();
panel.onChange((evt) -> {
choose(evt.getNewValue(), evt.getOldValue(), evt.isTemporary());
});
setWindowTitle(title);
setDestroyOnHide(true);
setResizable(true);
}
示例13: PersistentPanel
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public PersistentPanel(BaseScreen screen, String UID, int offset, VAlign vposition, Align hposition,
Size dimensions, SaveType saveType, Preferences pref) {
super(screen, UID,
ExtrasUtil.getWindowPosition(pref, screen, UID, ExtrasUtil.getWindowSize(pref, screen, UID, dimensions),
offset, hposition, vposition),
new Size(ExtrasUtil.getWindowSize(pref, screen, UID, dimensions)));
init(saveType, pref);
}
示例14: setData
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
@Override
public void setData(EntityData data) {
super.setData(data);
String text = data.getAsString("text");
String textKey = data.getAsString("textKey");
ColorRGBA color = data.getAsColor("fontColor");
float fontSize = data.getAsFloat("fontSize", UIFactory.getUIConfig().getBodyFontSize());
Align align = identifyAlign(data.getAsString("align"));
VAlign valign = identifyVAlign(data.getAsString("valign"));
if (text != null) {
textUI = new Text(text);
} else if (textKey != null) {
textUI = new Text(ResourceManager.get(textKey));
} else {
textUI = new Text("");
}
if (color != null) {
textUI.setFontColor(color);
}
if (align != null) {
textUI.setAlignment(align);
}
if (valign != null) {
textUI.setVerticalAlignment(valign);
}
textUI.setFontSize(fontSize);
viewRoot.addView(textUI);
}
示例15: identifyVAlign
import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
private VAlign identifyVAlign(String valign) {
if (valign == null)
return null;
if (valign.equals(VAlign.Bottom.name())) {
return VAlign.Bottom;
}
if (valign.equals(VAlign.Center.name())) {
return VAlign.Center;
}
if (valign.equals(VAlign.Top.name())) {
return VAlign.Top;
}
return null;
}