本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle类的典型用法代码示例。如果您正苦于以下问题:Java ListStyle类的具体用法?Java ListStyle怎么用?Java ListStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListStyle类属于com.badlogic.gdx.scenes.scene2d.ui.List包,在下文中一共展示了ListStyle类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stylePropertyChanged
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
@Override
public void stylePropertyChanged(StyleProperty styleProperty,
Actor styleActor) {
if (styleProperty.type == Drawable.class) {
dialogFactory.showDialogDrawables(styleProperty);
} else if (styleProperty.type == Color.class) {
dialogFactory.showDialogColors(styleProperty);
} else if (styleProperty.type == BitmapFont.class) {
dialogFactory.showDialogFonts(styleProperty);
} else if (styleProperty.type == Float.TYPE) {
main.getUndoableManager().addUndoable(new UndoableManager.DoubleUndoable(main, styleProperty, ((Spinner) styleActor).getValue()), false);
} else if (styleProperty.type == ScrollPaneStyle.class) {
main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
} else if (styleProperty.type == LabelStyle.class) {
main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
} else if (styleProperty.type == ListStyle.class) {
main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
}
}
示例2: layout
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
@Override
public void layout () {
Drawable bg = style.background;
BitmapFont font = style.font;
if (bg != null) {
prefHeight = Math.max(bg.getTopHeight() + bg.getBottomHeight() + font.getCapHeight() - font.getDescent() * 2,
bg.getMinHeight());
} else
prefHeight = font.getCapHeight() - font.getDescent() * 2;
float maxItemWidth = 0;
for (int i = 0; i < items.size; i++)
maxItemWidth = Math.max(font.getBounds(items.get(i).toString()).width, maxItemWidth);
prefWidth = maxItemWidth;
if (bg != null) prefWidth += bg.getLeftWidth() + bg.getRightWidth();
ListStyle listStyle = style.listStyle;
ScrollPaneStyle scrollStyle = style.scrollStyle;
prefWidth = Math.max(
prefWidth,
maxItemWidth
+ (scrollStyle.background == null ? 0 : scrollStyle.background.getLeftWidth()
+ scrollStyle.background.getRightWidth())
+ listStyle.selection.getLeftWidth()
+ listStyle.selection.getRightWidth()
+ Math.max(style.scrollStyle.vScroll != null ? style.scrollStyle.vScroll.getMinWidth() : 0,
style.scrollStyle.vScrollKnob != null ? style.scrollStyle.vScrollKnob.getMinWidth() : 0));
}
示例3: SelectBoxStyle
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
public SelectBoxStyle (BitmapFont font, Color fontColor, Drawable background, ScrollPaneStyle scrollStyle,
ListStyle listStyle) {
this.font = font;
this.fontColor.set(fontColor);
this.background = background;
this.scrollStyle = scrollStyle;
this.listStyle = listStyle;
}
示例4: ScrollList
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
public ScrollList (ListStyle liststyle,ScrollPaneStyle scrollpanestyle ) {
super();
list = new List (new String[]{""},liststyle);
scrollpane = new ScrollPane (list,scrollpanestyle);
scrollpane.setFadeScrollBars(false);
addActor(scrollpane);
}
示例5: onFinishLoading
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
@Override
public void onFinishLoading() {
Skin skin = getSkin(Assets.Skin.UI_SKIN);
BitmapFont menuFont = getFont(game.deviceSettings.menuFont);
BitmapFont screenTitle = getFont(game.deviceSettings.screenTitleFont);
BitmapFont hudFont = getFont(game.deviceSettings.hudFont);
BitmapFont rulesFont = getFont(game.deviceSettings.rulesFont);
skin.get(Assets.Skin.SKIN_STYLE_MENU, TextButtonStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, TextButtonStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_DIALOG, TextButtonStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, ImageTextButtonStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, ImageTextButtonStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).listStyle.font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).listStyle.font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_DIALOG, WindowStyle.class).titleFont = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, LabelStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_SCREEN_TITLE, LabelStyle.class).font = screenTitle;
skin.get(Assets.Skin.SKIN_STYLE_GAME, LabelStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_DIALOG, LabelStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_PLAYER_TAG, LabelStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_RULES, LabelStyle.class).font = rulesFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, TextFieldStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, TextFieldStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, CheckBoxStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, CheckBoxStyle.class).font = hudFont;
skin.get(Assets.Skin.SKIN_STYLE_MENU, ListStyle.class).font = menuFont;
skin.get(Assets.Skin.SKIN_STYLE_GAME, ListStyle.class).font = hudFont;
}
示例6: createList
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
private void createList() {
Skin skin = getGameObject().getComponentInParent(JCanvas.class).getSkin();
ListStyle style = new ListStyle(skin.get("default", ListStyle.class));
int realSize = (int) (((getTransform().getScale().x + getTransform().getScale().y) / 2) * fontSize);
Gdx.app.log("JLabel", "font size: " + realSize);
SmartFontGenerator fontGen = new SmartFontGenerator();
FileHandle exoFile = Gdx.files.internal(fontResource.getResourcePath());
BitmapFont fontBitmap = fontGen.createFont(exoFile, fontResource.getResourcePath() + realSize, realSize);
if (fontBitmap != null) {
style.font = fontBitmap;
}
if (fontColorSelected != null) {
style.fontColorSelected = fontColorSelected;
}
if (fontColorSelected != null) {
style.fontColorUnselected = fontColorUnselected;
}
if (selection != null) {
style.selection = DrawableHelper.getDrawableFromAsset(selection.getResourcePath());
}
if (background != null) {
style.background = DrawableHelper.getDrawableFromAsset(background.getResourcePath());
}
list = new List<T>(style);
list.setItems(tempItems);
list.getSelection().setMultiple(false);
list.getSelection().setRequired(true);
if (list.getItems().size > 0) {
list.setSelectedIndex(1);
}
list.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
Gdx.app.log("JList", "event: " + event);
;
return false;
}
});
scrollPane = new ScrollPane(list, skin);
scrollPane.setFlickScroll(false);
}
示例7: resetProperties
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
public void resetProperties() {
properties.clear();
if (clazz.equals(Button.class)) {
newStyleProperties(ButtonStyle.class);
} else if (clazz.equals(CheckBox.class)) {
newStyleProperties(CheckBoxStyle.class);
properties.get("checkboxOn").optional = false;
properties.get("checkboxOff").optional = false;
properties.get("font").optional = false;
} else if (clazz.equals(ImageButton.class)) {
newStyleProperties(ImageButtonStyle.class);
} else if (clazz.equals(ImageTextButton.class)) {
newStyleProperties(ImageTextButtonStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(Label.class)) {
newStyleProperties(LabelStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(List.class)) {
newStyleProperties(ListStyle.class);
properties.get("font").optional = false;
properties.get("fontColorSelected").optional = false;
properties.get("fontColorUnselected").optional = false;
properties.get("selection").optional = false;
} else if (clazz.equals(ProgressBar.class)) {
newStyleProperties(ProgressBarStyle.class);
//Though specified as optional in the doc, there are bugs without "background" being mandatory
properties.get("background").optional = false;
} else if (clazz.equals(ScrollPane.class)) {
newStyleProperties(ScrollPaneStyle.class);
} else if (clazz.equals(SelectBox.class)) {
newStyleProperties(SelectBoxStyle.class);
properties.get("font").optional = false;
properties.get("fontColor").optional = false;
properties.get("scrollStyle").optional = false;
properties.get("scrollStyle").value = "default";
properties.get("listStyle").optional = false;
properties.get("listStyle").value = "default";
} else if (clazz.equals(Slider.class)) {
newStyleProperties(SliderStyle.class);
//Though specified as optional in the doc, there are bugs without "background" being mandatory
properties.get("background").optional = false;
} else if (clazz.equals(SplitPane.class)) {
newStyleProperties(SplitPaneStyle.class);
properties.get("handle").optional = false;
} else if (clazz.equals(TextButton.class)) {
newStyleProperties(TextButtonStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(TextField.class)) {
newStyleProperties(TextFieldStyle.class);
properties.get("font").optional = false;
properties.get("fontColor").optional = false;
} else if (clazz.equals(TextTooltip.class)) {
newStyleProperties(TextTooltipStyle.class);
properties.get("label").optional = false;
properties.get("label").value = "default";
} else if (clazz.equals(Touchpad.class)) {
newStyleProperties(TouchpadStyle.class);
} else if (clazz.equals(Tree.class)) {
newStyleProperties(TreeStyle.class);
properties.get("plus").optional = false;
properties.get("minus").optional = false;
} else if (clazz.equals(Window.class)) {
newStyleProperties(WindowStyle.class);
properties.get("titleFont").optional = false;
}
}
示例8: CategoryStatsScreen
import com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle; //导入依赖的package包/类
public CategoryStatsScreen(MissingWords missingWords) {
super(missingWords);
font = new BitmapFont(Gdx.files.internal("fonts/title.fnt"), Gdx.files.internal("fonts/title.png"), false);
fontList = new BitmapFont(Gdx.files.internal("fonts/listFont.fnt"), Gdx.files.internal("fonts/listFont.png"), false);
/* Creamos el fondo de pantalla */
background = new Background(MissingWords.myManager.get("background.png", Texture.class));
stage.addActor(background);
/* Creamos el bot�n de vuelta atr�s */
backButton = new BackButton();
backButton.addListener(new BackButtonListener(missingWords));
/* Creamos la tabla que ocupar� todo el stage (pantalla) */
stageTable = new Table();
stageTable.setFillParent(true);
/* Creamos la etiqueta de la categor�a */
title = new Label(null, new LabelStyle(font, font.getColor()));
/* Creamos el progreso de la categor�a */
progress = new Label(null, new LabelStyle(font, font.getColor()));
/* Creamos la lista de palabras de la categor�a */
list = new List<String>(new ListStyle(
fontList,
fontList.getColor(),
fontList.getColor(),
new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("selection.png", Texture.class)))));
/* Creamos el scroll para la lista de palabras */
ScrollPane scroll = new ScrollPane(list, new ScrollPaneStyle(new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("background.png", Texture.class))),
null,
null,
new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("verticalScroll.png", Texture.class))),
new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("squareBlue.png", Texture.class)))));
/* Creamos la tabla izquierda del SplitPane */
left = new Table();
left.add(title).expand();
left.row();
left.add(progress).expand();
left.row();
left.add(backButton).align(Align.left).pad(10);
/* Creamos la tabla derecha del SplitPane */
right = new Table();
right.add(scroll).fill().expand();
/* Creamos el SplitPane */
SplitPane split = new SplitPane(left, right, false, new SplitPaneStyle(
new TextureRegionDrawable(
new TextureRegion(MissingWords.myManager.get("split.png", Texture.class)))));
stageTable.add(split).fill().expand(); // A�adimos el SplitPane a la stageTable
stage.addActor(stageTable); // A�adimos la stageTable al stage
}