當前位置: 首頁>>代碼示例>>Java>>正文


Java List.ListStyle方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java List.ListStyle方法的具體用法?Java List.ListStyle怎麽用?Java List.ListStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.List的用法示例。


在下文中一共展示了List.ListStyle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeCustomGUISkin

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private static void makeCustomGUISkin() {
	ResolutionIndependentAtlas skinAtlas = new ResolutionIndependentAtlas(Gdx.files.internal("hud/skin.txt"));

	int size = 4;
	NinePatchDrawable buttonNormal = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button"), size, size, size, size));
	NinePatchDrawable buttonDown = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button-down"), size, size, size, size));
	NinePatchDrawable buttonDisabled = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button"), size, size, size, size));
	buttonDisabled.getPatch().getColor().a = 0.75f;

	customSkin = new Skin();

	CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle();
	checkBoxStyle.checkboxOn = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("checkbox-on")));
	checkBoxStyle.checkboxOff = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("checkbox-off")));
	checkBoxStyle.font = FontManager.Default.getFont();
	checkBoxStyle.fontColor = Color.WHITE;
	customSkin.add("default", checkBoxStyle);

	Slider.SliderStyle sliderStyle = new Slider.SliderStyle(new NinePatchDrawable(new NinePatch(new Texture(WHITE_SWATCH), Color.LIGHT_GRAY)),
			new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("slider-handle"))));
	customSkin.add("default-horizontal", sliderStyle);

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = buttonNormal;
	textButtonStyle.font = FontManager.Roboto18.getFont();
	textButtonStyle.fontColor = Color.WHITE;
	textButtonStyle.down = buttonDown;
	textButtonStyle.downFontColor = Color.WHITE;
	textButtonStyle.disabled = buttonDisabled;

	customSkin.add("default", textButtonStyle);

	textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = buttonNormal;
	textButtonStyle.font = FontManager.Roboto18.getFont();
	textButtonStyle.fontColor = Color.WHITE;
	textButtonStyle.down = buttonDown;
	textButtonStyle.downFontColor = Color.WHITE;
	textButtonStyle.checked = buttonDown;
	textButtonStyle.checkedFontColor = Color.WHITE;

	customSkin.add("toggle-button", textButtonStyle);

	TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle();
	textFieldStyle.background = buttonNormal;
	textFieldStyle.font = FontManager.Roboto18.getFont();
	textFieldStyle.fontColor = Color.WHITE;
	textFieldStyle.messageFont = FontManager.Roboto18.getFont();
	textFieldStyle.messageFontColor = Color.LIGHT_GRAY;
	textFieldStyle.cursor = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("text-cursor"), size, size, size, size));
	textFieldStyle.selection = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("text-selection")));

	customSkin.add("default", textFieldStyle);

	SelectBox.SelectBoxStyle selectBoxStyle = new SelectBox.SelectBoxStyle();
	selectBoxStyle.background = buttonNormal;
	selectBoxStyle.font = FontManager.Roboto18.getFont();
	selectBoxStyle.fontColor = Color.WHITE;
	selectBoxStyle.listStyle = new List.ListStyle();
	selectBoxStyle.background = buttonNormal;
	selectBoxStyle.listStyle.selection = buttonDown;

	customSkin.add("default", selectBoxStyle);
}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:65,代碼來源:TowerAssetManager.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。