• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VAlign类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jme3.font.BitmapFont.VAlign的典型用法代码示例。如果您正苦于以下问题:Java VAlign类的具体用法?Java VAlign怎么用?Java VAlign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VAlign类属于com.jme3.font.BitmapFont包,在下文中一共展示了VAlign类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:17,代码来源:ExtrasUtil.java


示例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);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:ExtrasUtil.java


示例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);
        }
    });
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:25,代码来源:ClientsView.java


示例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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:BitmapText.java


示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:9,代码来源:CssUtil.java


示例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;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:11,代码来源:CssUtil.java


示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:9,代码来源:CssUtil.java


示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:15,代码来源:Element.java


示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:10,代码来源:Element.java


示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:20,代码来源:BaseElement.java


示例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;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:8,代码来源:BaseElement.java


示例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);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:14,代码来源:AbstractChooserDialog.java


示例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);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:9,代码来源:PersistentPanel.java


示例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);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:31,代码来源:TextView.java


示例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;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:16,代码来源:TextView.java


示例16: resetAlignment

import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
protected void resetAlignment() {
    if( textBox == null )
        return;

    switch( hAlign ) {
        case Left:
            bitmapText.setAlignment(Align.Left);
            break;
        case Right:
            bitmapText.setAlignment(Align.Right);
            break;
        case Center:
            bitmapText.setAlignment(Align.Center);
            break;
    }
    switch( vAlign ) {
        case Top:
            bitmapText.setVerticalAlignment(VAlign.Top);
            break;
        case Bottom:
            bitmapText.setVerticalAlignment(VAlign.Bottom);
            break;
        case Center:
            bitmapText.setVerticalAlignment(VAlign.Center);
            break;
    }
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:28,代码来源:TextComponent.java


示例17: alignButtonsV

import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public void alignButtonsV(VAlign vAlign) {
	if (vAlign == VAlign.Top) {
		btnPrevElement.setY(getHeight()-btnPrevElement.getHeight());
		btnNextElement.setY(getHeight()-btnNextElement.getHeight());
	} else if (vAlign == VAlign.Center) {
		btnPrevElement.centerToParentV();
		btnNextElement.centerToParentV();
	} else if (vAlign == VAlign.Center) {
		btnPrevElement.setY(0);
		btnNextElement.setY(0);
	}	
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:13,代码来源:SlideTray.java


示例18: getVerticalAlignment

import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
public BitmapFont.VAlign getVerticalAlignment() {
    return block.getVerticalAlignment();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:BitmapText.java


示例19: align

import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
private void align() {
    final Align alignment = block.getAlignment();
    final VAlign valignment = block.getVerticalAlignment();
    if (block.getTextBox() == null || (alignment == Align.Left && valignment == VAlign.Top))
        return;
    LetterQuad cursor = tail.getPrevious();
    cursor.setEndOfLine();
    final float width = block.getTextBox().width;
    final float height = block.getTextBox().height;
    float lineWidth = 0;
    float gapX = 0;
    float gapY = 0;
    validateSize();
    if (totalHeight < height) { // align vertically only for no overflow
        switch (valignment) {
        case Top:
            gapY = 0;
            break;
        case Center:
            gapY = (height-totalHeight)*0.5f;
            break;
        case Bottom:
            gapY = height-totalHeight;
            break;
        }
    }
    while (!cursor.isHead()) {
        if (cursor.isEndOfLine()) {
            lineWidth = cursor.getX1()-block.getTextBox().x;
            if (alignment == Align.Center) {
                gapX = (width-lineWidth)/2;
            } else if (alignment == Align.Right) {
                gapX = width-lineWidth;
            } else {
                gapX = 0;
            }
        }
        cursor.setAlignment(gapX, gapY);
        cursor = cursor.getPrevious();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:Letters.java


示例20: getVerticalAlignment

import com.jme3.font.BitmapFont.VAlign; //导入依赖的package包/类
BitmapFont.VAlign getVerticalAlignment() {
    return valignment;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:StringBlock.java



注:本文中的com.jme3.font.BitmapFont.VAlign类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JobInProgress类代码示例发布时间:2022-05-22
下一篇:
Java Color类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap