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; }
public void generateLists(String type) { elist.offsetX2 = type.equals("equipment") ? 20 : 0; float y = pane.getScrollX(); Array<Item> sc = elist.getItems(); sc.clear(); for (Item e : GameViews.global.items.get(type)) { sc.add(e); } elist.layout(); for (Cell cell : topbar.getCells()) { ((TopBar) cell.getActor()).select(((TopBar) cell.getActor()).name.equals(type)); } pane.setScrollX(y); }