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

Java Align类代码示例

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

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



Align类属于com.jme3.font.BitmapFont包,在下文中一共展示了Align类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: wrapTextInXHTML

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public static String wrapTextInXHTML(String text, ColorRGBA col, Align align, String... cssResources) {
	final StringBuilder bui = new StringBuilder();
	bui.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
	bui.append("<!DOCTYPE html>\n");
	bui.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
	bui.append("<head>");
	for (String cssResource : cssResources) {
		bui.append("<link rel=\"stylesheet\" href=\"" + cssResource + "\"/>");
	}
	bui.append("</head>");
	bui.append(String.format(
			"<body style=\"background-color: inherit; color: #%02x%02x%02x; text-align: "
					+ align.name().toLowerCase() + ";\">\n",
			(int) (col.getRed() * 255), (int) (col.getGreen() * 255), (int) (col.getBlue() * 255)));
	bui.append(text);
	bui.append("</body>\n");
	bui.append("</html>\n");
	return bui.toString();
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:20,代码来源:XHTMLLabel.java


示例2: updateLineForAlignment

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
private void updateLineForAlignment(Align textAlign, int head, int tail, float width, float lnWidth) {
	if (tail == letters.length - 1)
		tail = letters.length;
	switch (textAlign) {
	case Right:
		for (int xi = head; xi < tail; xi++) {
			letters[xi].setPositionX(letters[xi].getPositionX() + (width - lnWidth));
			if (hasLines)
				lines[xi].setPositionX(lines[xi].getPositionX() + (width - lnWidth));
		}
		break;
	case Center:
		for (int xi = head; xi < tail; xi++) {
			letters[xi].setPositionX(letters[xi].getPositionX() + ((width / 2) - (lnWidth / 2)));
			if (hasLines)
				lines[xi].setPositionX(lines[xi].getPositionX() + ((width / 2) - (lnWidth / 2)));
		}
		break;
	default:
		break;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:23,代码来源:AnimText.java


示例3: getDefaultHorizontal

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public static float getDefaultHorizontal(int offset, Align defaultHorizontal, BaseScreen screen,
		Vector2f windowSize) {
	float x = 0;
	switch (defaultHorizontal) {
	case Left:
		x = offset;
		break;
	case Right:
		x = screen.getWidth() - (windowSize == null ? (screen.getWidth() / 2) : windowSize.x) - offset;
		break;
	case Center:
		x = (int) ((screen.getWidth() - (windowSize == null ? (screen.getHeight() / 2) : windowSize.y)) / 2.0F);
		break;
	}
	return x;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:17,代码来源:ExtrasUtil.java


示例4: getWindowPosition

import com.jme3.font.BitmapFont.Align; //导入依赖的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


示例5: updateLineForAlignment

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
private void updateLineForAlignment(Align textAlign, int head, int tail, float width, float lnWidth) {
	if (tail == letters.length-1) tail = letters.length;
	switch (textAlign) {
		case Right:
			for (int xi = head; xi < tail; xi++) {
				letters[xi].setPositionX(letters[xi].getPositionX()+(width-lnWidth));
				if (hasLines) lines[xi].setPositionX(lines[xi].getPositionX()+(width-lnWidth));
			}
			break;
		case Center:
			for (int xi = head; xi < tail; xi++) {
				letters[xi].setPositionX(letters[xi].getPositionX()+((width/2)-(lnWidth/2)));
				if (hasLines) lines[xi].setPositionX(lines[xi].getPositionX()+((width/2)-(lnWidth/2)));
			}
			break;
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:18,代码来源:AnimText.java


示例6: setTextAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public void setTextAlign(Align textAlign) {
	this.textAlign = textAlign;
	currentAlign = textAlign;
	switch (textWrap) {
		case Character:
			wrapTextToCharacter(bounds.x);
			break;
		case Word:
			wrapTextToWord(bounds.x);
			break;
		case NoWrap:
			wrapTextNoWrap();
			break;
		case Clip:
			wrapTextNoWrap();
			break;
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:19,代码来源:AnimText.java


示例7: setAlignment

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
/**
 * Set horizontal alignment. Applicable only when text bound is set.
 * @param align
 */
public void setAlignment(BitmapFont.Align align) {
    if (block.getTextBox() == null && align != Align.Left) {
        throw new RuntimeException("Bound is not set");
    }
    block.setAlignment(align);
    letters.invalidate();
    needRefresh = true;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:BitmapText.java


示例8: StringBlock

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
/**
 *
 * @param text the text that the StringBlock will hold
 * @param textBox the rectangle that constrains the text
 * @param alignment the initial alignment of the text
 * @param size the size in pixels (vertical size of a single line)
 * @param color the initial color of the text
 * @param kerning
 */
StringBlock(String text, Rectangle textBox, BitmapFont.Align alignment, float size, ColorRGBA color,
        boolean kerning) {
    this.text = text;
    this.textBox = textBox;
    this.alignment = alignment;
    this.size = size;
    this.color.set(color);
    this.kerning = kerning;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:StringBlock.java


示例9: toAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public static Align toAlign(String align) {
	if (align.equalsIgnoreCase("center")) {
		return Align.Center;
	} else if (align.equalsIgnoreCase("right")) {
		return Align.Right;
	}
	return Align.Left;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:9,代码来源:CssUtil.java


示例10: alignToIdent

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public static IdentValue alignToIdent(BitmapFont.Align textAlign) {
	switch (textAlign) {
	case Left:
		return IdentValue.LEFT;
	case Right:
		return IdentValue.RIGHT;
	default:
		return IdentValue.MIDDLE;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:11,代码来源:CssUtil.java


示例11: identToAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public static Align identToAlign(IdentValue ident) {
	if (ident == IdentValue.LEFT) {
		return Align.Left;
	} else if (ident == IdentValue.RIGHT) {
		return Align.Right;
	}
	return Align.Center;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:9,代码来源:CssUtil.java


示例12: preferredSize

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
@Override
public Vector2f preferredSize(Button parent) {
	Vector2f pref = super.preferredSize(parent);

	Vector2f ip = parent.getButtonIcon().calcPreferredSize();
	if (parent.getButtonIcon().getElementTexture() != null || !Vector2f.ZERO.equals(ip)) {
		Vector2f ps = new Vector2f();

		float bw = ip == null ? -1 : ip.x;
		float bh = ip == null ? -1 : ip.y;
		if (Vector2f.ZERO.equals(ip)) {
			float sc = Math.min(ps.x, ps.y);
			bw = sc / 2f;
			bh = sc / 2f;
		}

		Vector4f padding = parent.getAllPadding();
		if ((parent.getTextElement() == null || "".equals(parent.getText()))) {
			ps.x = bw + padding.x + padding.y;
			ps.y = Math.max(pref.y, bh + padding.z + padding.w);
		} else {
			if (parent.getButtonIconAlign() == Align.Center) {
				ps.x = Math.max(pref.x, bw + padding.x + padding.y);
				ps.y = pref.y + bh + parent.getIndent();
			} else {
				ps.x = pref.x + bw + parent.getIndent();
				ps.y = Math.max(pref.y, bh + padding.z + padding.w);
			}
		}
		pref = ps;
	}
	return pref;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:34,代码来源:Button.java


示例13: calcTextOffset

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
@Override
protected Vector4f calcTextOffset(Button element, AnimText textElement, Vector4f textPadding) {
	Vector4f off = super.calcTextOffset(element, textElement, textPadding).clone();
	Vector2f ip = element.getButtonIcon().calcPreferredSize();
	if (element.getButtonIcon().getElementTexture() != null || !Vector2f.ZERO.equals(ip)) {

		Vector2f ps = element.getDimensions().clone();
		Vector2f sz = ip.clone();
		if (Vector2f.ZERO.equals(ip)) {
			// Element is as big as we want it
			float sc = Math.min(ps.x, ps.y);
			sz.x = sc / 2f;
			sz.y = sc / 2f;
		}
		//
		if (element.getText() != null && !"".equals(element.getText())) {
			switch (element.getButtonIconAlign()) {
			case Left:
				off.x += sz.x + element.getIndent();
				;
				break;
			case Right:
				if (textElement.getTextAlign() != Align.Left)
					off.y += sz.x + element.getIndent();
				break;
			default:
				break;
			}

		}
	}

	return off;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:35,代码来源:Button.java


示例14: setTextAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
/**
 * Sets the element's text layer horizontal alignment
 * 
 * @param textAlign
 */
@Override
public BaseElement setTextAlign(BitmapFont.Align textAlign) {
	PropertyDeclaration decl = new PropertyDeclaration(CSSName.TEXT_ALIGN,
			new PropertyValue(CssUtil.alignToIdent(textAlign)), false, StylesheetInfo.USER);
	cssState.addAllCssDeclaration(decl);
	applyCss(decl);
	layoutChildren();
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:15,代码来源:Element.java


示例15: calcAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
protected Align calcAlign() {
	CascadedStyle style = cssState.getCascadedStyle(false);
	if (style != null) {
		PropertyDeclaration pv = style.propertyByName(CSSName.TEXT_ALIGN);
		if (pv != null)
			return CssUtil.identToAlign(pv.asIdentValue());
	}
	return Align.Center;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:10,代码来源:Element.java


示例16: setAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public BaseElement setAlign(Align align) {
	if (!Objects.equals(align, this.align)) {
		this.align = align;
		updateNodeLocation();
	}
	return this;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:8,代码来源:BaseElement.java


示例17: setTextAlign

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
/**
 * Sets the element's text layer horizontal alignment
 * 
 * @param textAlign
 */
public BaseElement setTextAlign(BitmapFont.Align textAlign) {
	this.textAlign = textAlign;
	if (textElement != null) {
		textElement.setTextAlign(textAlign);

		/*
		 * 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


示例18: rebuild

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
public void rebuild(I cwd, Collection<I> filesNames) {
	if (rebuilding) {
		throw new IllegalStateException("Already rebuilding");
	}
	rebuilding = true;
	this.cwd = cwd;
	items.clear();
	screen.getApplication().enqueue(new Callable<Void>() {
		public Void call() throws Exception {
			chooser.busy();
			return null;
		}
	});

	for (I s : filesNames) {
		Thread.yield();
		final SelectableItem uib = new SelectableItem(screen);
		uib.setLayoutManager(new FlowLayout(0, Align.Left));
		configureButton(uib, s);
		items.put(s, uib);
	}
	rebuilding = false;
	screen.getApplication().enqueue(new Callable<Void>() {
		public Void call() throws Exception {
			scrollPanel.invalidate();
			scrollContent.removeAllChildren();
			List<SelectableItem> is = new ArrayList<>();
			synchronized (items) {
				is.addAll(items.values());
			}
			for (SelectableItem it : is)
				scrollPanel.addScrollableContent(it);
			scrollPanel.validate();
			chooser.idle();
			return null;
		}
	});
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:39,代码来源:AbstractButtonView.java


示例19: AbstractChooserDialog

import com.jme3.font.BitmapFont.Align; //导入依赖的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


示例20: createContent

import com.jme3.font.BitmapFont.Align; //导入依赖的package包/类
@Override
protected XHTMLLabel createContent() {
	XHTMLLabel label = new XHTMLLabel(screen) {
		@Override
		public Align getAlign() {
			return AlertBox.this.getAlign();
		}
	};
	label.setStyleId("alert-message");
	return label;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:12,代码来源:AlertBox.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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