Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.ScrollPane#setFadeScrollBars()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.ScrollPane#setFadeScrollBars() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PathFinderTests.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
protected CollapsableWindow addBehaviorSelectionWindow (String title, List<String> testList, float x, float y) {

		CollapsableWindow window = new CollapsableWindow(title, skin);
		window.row();

		ScrollPane pane = new ScrollPane(testList, skin);
		pane.setFadeScrollBars(false);
		pane.setScrollX(0);
		pane.setScrollY(0);

		window.add(pane);
		window.pack();
		window.pack();
		if (window.getHeight() > stage.getHeight()) {
			window.setHeight(stage.getHeight());
		}
		window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
		window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
		window.layout();
		window.collapse();
		stage.addActor(window);

		return window;
	}
 
Example 2
Source File: MessageTests.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
protected CollapsableWindow addTestSelectionWindow (String title, List<String> testList, float x, float y) {
	CollapsableWindow window = new CollapsableWindow(title, skin);
	window.row();

	ScrollPane pane = new ScrollPane(testList, skin);
	pane.setFadeScrollBars(false);
	pane.setScrollX(0);
	pane.setScrollY(0);

	window.add(pane);
	window.pack();
	window.pack();
	if (window.getHeight() > stage.getHeight()) {
		window.setHeight(stage.getHeight());
	}
	window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
	window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
	window.layout();
	window.collapse();
	stage.addActor(window);

	return window;
}
 
Example 3
Source File: TextInputPanel.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
TextInputPanel(Skin skin, String title, String desc, boolean mandatory, String defaultValue) {
	input = new TextArea("", skin) {
		@Override
		public float getPrefHeight () {
			
			calculateOffsets();
			
			float prefHeight =  Math.max(prefRows, getLines()) * textHeight;
			
			if (getStyle().background != null) {
				prefHeight = Math.max(prefHeight + getStyle().background.getBottomHeight() + getStyle().background.getTopHeight(),
						getStyle().background.getMinHeight());
			}
			return prefHeight;
		}
		
		@Override
		public void moveCursorLine (int line) {
			super.moveCursorLine(line);
			
			scroll.setScrollPercentY((line)/(float)input.getLines());
		}
       };
       
       
	input.setPrefRows(prefRows);
	
	scroll = new ScrollPane(input, skin);
	
	scroll.setFadeScrollBars(false);
	
	init(skin, title, desc, scroll, mandatory, defaultValue);
	
	getCell(scroll).maxHeight(input.getStyle().font.getLineHeight() * prefRows + input.getStyle().background.getBottomHeight() + input.getStyle().background.getTopHeight());
}
 
Example 4
Source File: SteeringBehaviorsTest.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
private CollapsableWindow addTestSelectionWindow (String title, String[] tabTitles, Array<List<String>> tabLists,
	float x, float y) {
	if (tabTitles.length != tabLists.size)
		throw new IllegalArgumentException("tabTitles and tabList must have the same size.");
	CollapsableWindow window = new CollapsableWindow(title, skin);
	window.row();
	TabbedPane tabbedPane = new TabbedPane(skin);
	for (int i = 0; i < tabLists.size; i++) {
		ScrollPane pane = new ScrollPane(tabLists.get(i), skin);
		pane.setFadeScrollBars(false);
		pane.setScrollX(0);
		pane.setScrollY(0);

		tabbedPane.addTab(" " + tabTitles[i] + " ", pane);
	}
	window.add(tabbedPane);
	window.pack();
	window.pack();
	if (window.getHeight() > stage.getHeight()) {
		window.setHeight(stage.getHeight());
	}
	window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
	window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
	window.layout();
	window.collapse();
	stage.addActor(window);

	return window;
}
 
Example 5
Source File: TestTextAreaAndScroll.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
private void addNormalWidgets () {
	Skin skin = VisUI.getSkin();

	TextArea textArea = new TextArea("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis odio.", skin);
	textArea.setPrefRows(5);

	// ---

	VisTable table = new VisTable();

	for (int i = 0; i < 20; i++)
		table.add(new Label("Label #" + (i + 1), skin)).expand().fill().row();

	ScrollPane scrollPane = new ScrollPane(table, skin, "list");
	scrollPane.setFlickScroll(false);
	scrollPane.setFadeScrollBars(false);

	// ---

	add(textArea).row();
	add(scrollPane).spaceTop(8).fillX().expandX().row();
}
 
Example 6
Source File: FontPickerDialog.java    From gdx-skineditor with Apache License 2.0 2 votes vote down vote up
/**
 * 
 */
public FontPickerDialog(final SkinEditorGame game, Field field) {

	super("Bitmap Font Picker", game.skin);

	this.game = game;
	this.field = field;

	tableFonts = new Table(game.skin);
	tableFonts.left().top().pad(5);
	tableFonts.defaults().pad(5);

	fonts = game.skinProject.getAll(BitmapFont.class);

	updateTable();

	TextButton buttonNewFont = new TextButton("New Font", game.skin);
	buttonNewFont.addListener(new ChangeListener() {

		@Override
		public void changed(ChangeEvent event, Actor actor) {

			showNewFontDialog();

		}

	});


	ScrollPane scrollPane = new ScrollPane(tableFonts, game.skin);
	scrollPane.setFlickScroll(false);
	scrollPane.setFadeScrollBars(false);
	scrollPane.setScrollbarsOnTop(true);

	getContentTable().add(scrollPane).width(720).height(420).pad(20);
	getButtonTable().add(buttonNewFont);
	getButtonTable().padBottom(15);
	button("Cancel", false);
	key(com.badlogic.gdx.Input.Keys.ESCAPE, false);

}