public void start(Stage primaryStage, ScrollPane rootLayout) throws Exception { primaryStage.setTitle("Change Hotkeys"); Scene myScene = new Scene(rootLayout); ourStage = primaryStage; myScene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { public void handle(KeyEvent event) { if (changeHotkey) { if (addHotkey(event, changeHotkeyFunction)) { changeHotkey = false; } } } }); Label divider = new Label(); HBox labelHbox = new HBox(divider); divider.setText("----These hotkeys are not changeable----"); labelHbox.setAlignment(Pos.CENTER); for (String key : HOTKEYS) { hotkeyVBox.getChildren().add(hotkeys.get(key).getHotkeyHBox()); } hotkeyVBox.getChildren().add(labelHbox); for (ImmutableHotkey hotkey : IMMUTABLE_HOTKEYS) { hotkeyVBox.getChildren().add(hotkey.getHotkeyHBox()); } primaryStage.setScene(myScene); }
void ensureVisible(double x, double y) { ScrollPane scrollPane = diagramController.getScrollPane(); double xScroll = (x - scrollPane.getWidth() / 2) / (8000 - scrollPane.getWidth()); double yScroll = (y - scrollPane.getHeight() / 2) / (8000 - scrollPane.getHeight()); final Timeline timeline = new Timeline(); final KeyValue kv1 = new KeyValue(scrollPane.hvalueProperty(), xScroll); final KeyValue kv2 = new KeyValue(scrollPane.vvalueProperty(), yScroll); final KeyFrame kf = new KeyFrame(Duration.millis(100), kv1, kv2); timeline.getKeyFrames().add(kf); timeline.play(); aScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); aScrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); }
/** * @param nodeConverter */ public FlowCardComposite() { scrollPane = new ScrollPane(); scrollPane.setFitToHeight(true); scrollPane.setFitToWidth(true); scrollPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); StackPane stackPane = new StackPane(scrollPane); stackPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); masonryPane = new JFXMasonryPane(); scrollPane.setContent(masonryPane); setCenter(stackPane); initialize(); masonryPane.setCache(false); setStyle("-fx-background-color : #292929"); }
void autofit() { Platform.runLater( new Runnable() { @Override public void run() { if( container.getScene().getRoot() instanceof ScrollPane ) { BorderPane pane = new BorderPane(); pane.setCenter( browser ); container.getScene().setRoot( pane ); } preferredWidth = -1; preferredHeight = -1; browser.setMaxWidth( Integer.MAX_VALUE ); browser.setMaxHeight( Integer.MAX_VALUE ); browser.setMinWidth( -1 ); browser.setMinHeight( -1 ); browser.autosize(); } }); }
private static void ensureVisible(ScrollPane pane, Node node) { Bounds viewport = pane.getViewportBounds(); double contentHeight = pane.getContent().getBoundsInLocal().getHeight(); double contentWidth = pane.getContent().getBoundsInLocal().getWidth(); double nodeMinY = node.getBoundsInParent().getMinY(); double nodeMaxY = node.getBoundsInParent().getMaxY(); double nodeMinX = node.getBoundsInParent().getMinX(); double nodeMaxX = node.getBoundsInParent().getMaxX(); double viewportMinY = (contentHeight - viewport.getHeight()) * pane.getVvalue(); double viewportMaxY = viewportMinY + viewport.getHeight(); double viewportMinX = (contentWidth - viewport.getWidth()) * pane.getHvalue(); double viewportMaxX = viewportMinX + viewport.getWidth(); if (nodeMinY < viewportMinY) { pane.setVvalue(nodeMinY / (contentHeight - viewport.getHeight())); } else if (nodeMaxY > viewportMaxY) { pane.setVvalue((nodeMaxY - viewport.getHeight()) / (contentHeight - viewport.getHeight())); } if (nodeMinX < viewportMinX) { pane.setHvalue(nodeMinX / (contentWidth - viewport.getWidth())); } else if (nodeMaxX > viewportMaxX) { pane.setHvalue((nodeMaxX - viewport.getWidth()) / (contentWidth - viewport.getWidth())); } }
private void initComponents(boolean selectable) { initVerticalButtonBar(); pane = new ScrollPane(); HBox.setHgrow(pane, Priority.ALWAYS); setCenter(pane); if (selectable) { setRight(verticalButtonBar); verticalButtonBar.setStyle("-fx-padding: 5px"); verticalButtonBar.setDisable(true); } VBox titleBox = new VBox(); Label titleLabel = new Label("Editing CheckList", FXUIUtils.getIcon("newCheckList")); titleLabel.getStyleClass().add("modaldialog-title"); titleBox.getChildren().add(titleLabel); titleBox.getChildren().add(new Separator()); setTop(titleBox); }
private Node createTextArea(boolean selectable, boolean editable) { textArea = new TextArea(); textArea.setPrefRowCount(4); textArea.setEditable(editable); textArea.textProperty().addListener((observable, oldValue, newValue) -> { text = textArea.getText(); }); textArea.setText(text); ScrollPane scrollPane = new ScrollPane(textArea); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS); HBox.setHgrow(scrollPane, Priority.ALWAYS); return scrollPane; }
private void initCheckList() { ToolBar toolBar = new ToolBar(); toolBar.getItems().add(new Text("Check Lists")); toolBar.setMinWidth(Region.USE_PREF_SIZE); leftPane.setTop(toolBar); checkListElements = checkListInfo.getCheckListElements(); checkListView = new ListView<CheckListForm.CheckListElement>(checkListElements); checkListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { CheckListElement selectedItem = checkListView.getSelectionModel().getSelectedItem(); if (selectedItem == null) { doneButton.setDisable(true); return; } Node checkListForm = getChecklistFormNode(selectedItem, Mode.DISPLAY); if (checkListForm == null) { doneButton.setDisable(true); return; } doneButton.setDisable(false); ScrollPane sp = new ScrollPane(checkListForm); sp.setFitToWidth(true); sp.setPadding(new Insets(0, 0, 0, 10)); rightPane.setCenter(sp); }); leftPane.setCenter(checkListView); }
protected void ensureVisible(Node target) { ScrollPane scrollPane = getParentScrollPane(target); if (scrollPane == null) { return; } Node content = scrollPane.getContent(); Bounds contentBounds = content.localToScene(content.getBoundsInLocal()); Bounds viewportBounds = scrollPane.getViewportBounds(); Bounds nodeBounds = target.localToScene(target.getBoundsInLocal()); if (scrollPane.contains(nodeBounds.getMinX() - contentBounds.getMinX(), nodeBounds.getMinY() - contentBounds.getMinY())) { return; } double toVScroll = (nodeBounds.getMinY() - contentBounds.getMinY()) * ((scrollPane.getVmax() - scrollPane.getVmin()) / (contentBounds.getHeight() - viewportBounds.getHeight())); scrollPane.setVvalue(toVScroll); double toHScroll = (nodeBounds.getMinX() - contentBounds.getMinX()) * ((scrollPane.getHmax() - scrollPane.getHmin()) / (contentBounds.getWidth() - viewportBounds.getWidth())); scrollPane.setHvalue(toHScroll); }
private void scrollTo(Node target) { ScrollPane scrollPane = getParentScrollPane(target); if (scrollPane == null) return; Node content = scrollPane.getContent(); Bounds contentBounds = content.localToScene(content.getBoundsInLocal()); Bounds viewportBounds = scrollPane.getViewportBounds(); Bounds nodeBounds = target.localToScene(target.getBoundsInLocal()); double toVScroll = (nodeBounds.getMinY() - contentBounds.getMinY()) * ((scrollPane.getVmax() - scrollPane.getVmin()) / (contentBounds.getHeight() - viewportBounds.getHeight())); if (toVScroll >= scrollPane.getVmin() && toVScroll < scrollPane.getVmax()) scrollPane.setVvalue(toVScroll); double toHScroll = (nodeBounds.getMinX() - contentBounds.getMinX()) * ((scrollPane.getHmax() - scrollPane.getHmin()) / (contentBounds.getWidth() - viewportBounds.getWidth())); if (toHScroll >= scrollPane.getHmin() && toHScroll < scrollPane.getHmax()) scrollPane.setHvalue(toHScroll); }
public SettingsViewSkin(SettingsView control) { super(control); VBox container = new VBox(); container.getStyleClass().add("container"); ScrollPane scrollPane = new ScrollPane(control.getSourceView()); scrollPane.setPrefViewportHeight(180); container.getChildren().addAll( new SectionTitle("Paper"), control.getPaperView(), new SectionTitle("Time Range"), control.getTimeRangeView(), new SectionTitle("Calendars"), scrollPane, new SectionTitle("Options"), control.getOptionsView()); getChildren().add(container); }
public static BorderPane homeProducts(){ VBox products = new VBox(20); products.getChildren().addAll( fetchProducts.productbyType("Discounts for You"), fetchProducts.productbyType("Featured Product"), fetchProducts.productbyType("New Arrival"), fetchProducts.productbyType("Trending")); ScrollPane proScroller = new ScrollPane(products); proScroller.setPrefHeight(400); proScroller.setFitToWidth(true); BorderPane home = new BorderPane(proScroller); return home; }
private void setup(Stage primaryStage) { Pane root = (Pane) FXML.load(getClass(), "/assets/scenes/MainScene.fxml"); root.setPrefSize(preferences.getInt("resolution.width"), preferences.getInt("resolution.height")); Scene scene = new Scene(root, preferences.getInt("resolution.width"), preferences.getInt("resolution.height")); CSS.load(getClass(), scene, "/assets/stylesheets/styles.css"); ScrollPane scrollPane = new ScrollPane(); scrollPane.setId("scrollpane"); root.getChildren().add(scrollPane); initBoxes(root, scene); SimpleStage stage = new SimpleStage(primaryStage); stage.setIcon(getClass(), "/assets/icon.png"); stage.show(scene, "JRFL v" + VERSION, preferences.getBoolean("resizable")); }
private void buildUI() { contentWrapper = new ScrollPane(); contentWrapper.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); getChildren().add(contentWrapper); setTopAnchor(contentWrapper, 0d); setLeftAnchor(contentWrapper, 0d); setBottomAnchor(contentWrapper, 0d); setRightAnchor(contentWrapper, 0d); logsContent = new VBox(); logsContent.heightProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { contentWrapper.setVvalue((Double) newValue); } }); logsContent.setSpacing(5); contentWrapper.setContent(logsContent); }
static public void setup_note_pane(ScrollPane scroll_pane, TilePane tile_pane, AnchorPane overlay ){ Note[] list_of_notes = new Note[7]; list_of_notes[0] = new Note("Assign 1", "M rao", "src/GUI/resources/main/writing.png"); list_of_notes[1] = new Note("Assign 1", "M rao", "src/GUI/resources/main/networking.png"); list_of_notes[2] = new Note("Assign 1", "M rao", "src/GUI/resources/main/group.png"); list_of_notes[3] = new Note("Assign 1", "M rao", "src/GUI/resources/main/writing.png"); list_of_notes[4] = new Note("Assign 1", "M rao", "src/GUI/resources/main/group.png"); list_of_notes[5] = new Note("Assign 1", "M rao", "src/GUI/resources/main/networking.png"); list_of_notes[6] = new Note("Assign 1", "M rao", "src/GUI/resources/main/writing.png"); notePane.make_note_pane(scroll_pane, tile_pane); notePane.populate_pane(tile_pane, list_of_notes, overlay); }
/** * Initializes the container which contains all the contents of the design board. */ private void initializeContainers () { this.setText(designboardProperties.getString("DesignBoardName")); this.setClosable(false); contentPane = new StackPane(); contentPane.setMinSize(width, height); scroller = new ScrollPane(); scroller.setContent(contentPane); zoomBar = new ToolBar(); container = new VBox(zoomBar, scroller); this.setContent(container); y_offset = width * RESIZE_FACTOR; x_offset = height * RESIZE_FACTOR; }
@Test public void shouldHandleClickByInstructingController() { systemUnderTest.handleBeingSelected(); verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() ); assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) ); SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue(); assertThat( title.getTitle(), is( StatisticsStyleItem.TITLE ) ); assertThat( title.getDescription(), is( StatisticsStyleItem.DESCRIPTION ) ); assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) ); ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue(); assertThat( scroller.getContent(), is( instanceOf( StatisticsStylePanel.class ) ) ); StatisticsStylePanel panel = ( StatisticsStylePanel ) scroller.getContent(); assertThat( panel.isAssociatedWith( configuration ), is( true ) ); }
public MonthBarChart(ArrayList<MonthInOutSum> monthInOutSums, String currency) { if(monthInOutSums == null) { this.monthInOutSums = new ArrayList<>(); } else { this.monthInOutSums = monthInOutSums; } this.currency = currency; ScrollPane scrollPane = new ScrollPane(); scrollPane.setVbarPolicy(ScrollBarPolicy.NEVER); scrollPane.setFocusTraversable(false); scrollPane.setStyle("-fx-background-color: transparent; -fx-background-insets: 0; -fx-border-color: transparent; -fx-border-width: 0; -fx-border-insets: 0;"); scrollPane.setPadding(new Insets(0, 0, 10, 0)); HBox generatedChart = generate(); scrollPane.setContent(generatedChart); generatedChart.prefHeightProperty().bind(scrollPane.heightProperty().subtract(30)); this.getChildren().add(scrollPane); VBox.setVgrow(scrollPane, Priority.ALWAYS); this.getChildren().add(generateLegend()); }
/** * Setup the popup's view. */ public void setupView() { getStylesheets().add("/css/buildingsPopUp.css"); BorderPane content = new BorderPane(); // buildings buildingsBox = new VBox(5); ScrollPane scrollPane = new ScrollPane(buildingsBox); content.setCenter(scrollPane); // buttons HBox buttonsBox = new HBox(10); buttonsBox.setPadding(new Insets(5)); Button remove = new Button("Bulldoze Building"); remove.getStyleClass().add("bulldoze-button"); remove.setOnMouseClicked(e -> WorldManager.getInstance().getWorld().startBulldozing()); buttonsBox.getChildren().add(remove); content.setBottom(buttonsBox); this.setContent(content); }
public HistoryListPopup(@Nullable String popupTitle, @NotNull HistoryListProvider provider) { super(ArmaDialogCreator.getPrimaryStage(), new VBox(5), popupTitle); this.provider = provider; myRootElement.setPadding(new Insets(10)); final ScrollPane scrollPane = new ScrollPane(stackPaneWrapper); VBox.setVgrow(scrollPane, Priority.ALWAYS); scrollPane.setFitToHeight(true); scrollPane.setFitToWidth(true); scrollPane.setStyle("-fx-background-color:transparent"); myRootElement.getChildren().addAll(scrollPane, new Separator(Orientation.HORIZONTAL), getBoundResponseFooter(false, true, false)); gridPaneContent.setVgap(15); gridPaneContent.setHgap(5); ColumnConstraints constraints = new ColumnConstraints(-1, -1, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true); gridPaneContent.getColumnConstraints().addAll(constraints, constraints); myStage.setMinWidth(320); myStage.setMinHeight(320); myStage.setWidth(480); stackPaneWrapper.setPrefHeight(320); fillContent(); }
private void drawCard(Player player, ScrollPane hand, Button deck) { if (player.canDraw()) { if (!isIA || (isIA && player == player1)) TransitionDeck_Hand(player, deck, hand); player.drawCard(); deck1.setDisable(true); deck2.setDisable(true); hand.setVvalue(hand.getVmax()); hand.setHvalue(hand.getHmax()); update(); if (!player.canPlay()) { if (player == player1) { TransitionAlert(Player1, energy_player1_bckgrd); } else { TransitionAlert(Player2, energy_player2_bckgrd); } } } else { if (player.equals(player1)) { AlertBox.displayDebugging("Error", "You cannot have more than \n 5 cards in your hand", 520, 290); } else { if (!isIA) AlertBox.displayDebugging("Error", "You cannot have more than \n 5 cards in your hand", 520, 290); } } }
private void listCreatureContents(Player current, ScrollPane scroll) { HBox content = new HBox(); scroll.setContent(content); content.setSpacing(20); for (Card c : current.getPlayerCreature()) { Rectangle rectangle = new Rectangle(100, 120); Image img = new Image("images/Spellmonger_" + c.getName() + ".png"); rectangle.setFill(new ImagePattern(img)); rectangle.setLayoutY(10); rectangle.getStyleClass().add("cartes_ombre"); content.getChildren().add(rectangle); if (!player1.isDead() && !player2.isDead()) { Rectangle newRectangle = new Rectangle(250, 300); eventEnter(rectangle, newRectangle, img); eventExit(rectangle, newRectangle); } } }
private void hands(Player current, Player oppenent, ScrollPane hand) { HBox content = new HBox(); hand.setContent(content); content.setSpacing(20); int index = 0; for (Card c : current.getHand()) { Rectangle rectangle = new Rectangle(100, 120); String imageOfCard = "Spellmonger_" + c.getName(); if (turnPlayer.equals(oppenent)) imageOfCard = "dosCartes_ocre"; if (isIA && current == player2) imageOfCard = "dosCartes_ocre"; Image img = new Image("images/" + imageOfCard + ".png"); rectangle.setFill(new ImagePattern(img)); rectangle.setLayoutY(10); rectangle.getStyleClass().add("cartes_ombre"); content.getChildren().add(rectangle); if (turnPlayer.equals(current) && !player1.isDead() && !player2.isDead()) { Rectangle newRectangle = new Rectangle(250, 300); eventEnter(rectangle, newRectangle, img); eventExit(rectangle, newRectangle); eventClick(rectangle, current, oppenent, index); } index++; } }
@Test public void shouldHandleClickByInstructingController() { systemUnderTest.handleBeingSelected(); verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() ); assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) ); SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue(); assertThat( title.getTitle(), is( StatisticsExclusionsItem.TITLE ) ); assertThat( title.getDescription(), is( StatisticsExclusionsItem.DESCRIPTION ) ); assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) ); ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue(); assertThat( scroller.getContent(), is( instanceOf( StatisticsExclusionsPanel.class ) ) ); StatisticsExclusionsPanel panel = ( StatisticsExclusionsPanel ) scroller.getContent(); assertThat( panel.isAssociatedWith( configuration ), is( true ) ); }
private void TransitionHand_Discard(Player current, Pane player_pane, Pane energy_pane, ScrollPane hand, Pane discard, int playerChoice) { Card cardSelected = current.getHand().get(playerChoice); double layoutXTransitionFrom = hand.getLayoutX(); double layoutXTransitionTo = discard.getLayoutX(); double layoutYTransition; if (cardSelected.getEnergyCost() <= current.getEnergyPerTurn()) { Rectangle rectangle = new Rectangle(100, 120); Image img = new Image("images/Spellmonger_" + cardSelected.getName() + ".png"); rectangle.setFill(new ImagePattern(img)); if (current == player1) { layoutYTransition = 62; } else { layoutYTransition = 545; } TransitionForAll(rectangle, layoutXTransitionFrom, layoutXTransitionTo, layoutYTransition, layoutYTransition); } else TransitionAlert(player_pane, energy_pane); }
@Override protected Scene getScene() { scene = new Scene(root, 320, 200, Color.WHITE); VBox vb = new VBox(); vb.setPrefSize(250, 150); TextArea textArea = new TextArea(); ScrollPane scrollPane = new ScrollPane(); for (int i = 0; i < 100; ++i) { textArea.setText(textArea.getText() + "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n"); } root.getChildren().add(vb); vb.getChildren().add(textArea); vb.getChildren().add(scrollPane); scrollPane.setContent(new Rectangle(1000,1000,Color.RED)); //Utils.addBrowser(scene); return scene; }
public void addPropertiesTable(String domainName, Node content) { try { final Tab newTab = new Tab(domainName); final ScrollPane sp = new ScrollPane(); sp.setPannable(true); sp.setContent(content); sp.setPrefSize(content.getBoundsInLocal().getWidth(), content.getBoundsInLocal().getHeight()); sp.setMaxSize(1000, 1000); content.boundsInLocalProperty().addListener(new ChangeListener<Bounds>() { public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) { sp.setPrefSize(t1.getWidth(), t1.getHeight()); } }); content.setId(domainName.toUpperCase() + PropertiesTable.PROPERTIES_TABLE_SUFFIX_ID); newTab.setContent(sp); sp.setId(domainName + TAB_CONTENT_ID); this.getTabs().add(newTab); } catch (Throwable ex) { log(ex); } }
@Override public void start(Stage primaryStage) throws Exception { AnchorPane ap = new AnchorPane(); ap.setPrefWidth(1000); ap.setPrefHeight(1000); ScrollPane s = new ScrollPane(ap); s.setHvalue(HVALUE_EXPECTED); s.setVvalue(VVALUE_EXPECTED); Scene root = new Scene(new VBox(s), 320, 240); primaryStage.setScene(root); primaryStage.setOnShown((WindowEvent event) -> { System.out.println("Scroll values are not expected to be 0."); System.out.println("HValue: " + s.getHvalue()); System.out.println("VValue: " + s.getVvalue()); VALUE_SAME.set((HVALUE_EXPECTED == s.getHvalue()) && (VVALUE_EXPECTED == s.getVvalue())); Platform.runLater(primaryStage::close); }); primaryStage.show(); }
@Override protected Scene getScene() { application = this; sp = new ScrollPane(buildContent()); sp.setFitToWidth(true); sp.setBackground(Background.EMPTY); Scene scene = new Scene(sp, WIDTH, HEIGHT); Utils.addBrowser(scene); scene.setOnKeyPressed(new EventHandler<KeyEvent>() { public void handle(KeyEvent t) { switch (t.getText().charAt(0)) { case '1': scrollToMark(0); break; case '2': scrollToMark(1); break; case '3': scrollToMark(2); break; }; } }); return scene; }
/** * Work with context menu. * */ @Test public void pushContextMenuItem() { NodeDock scrollPane = new NodeDock(scene.asParent(), ScrollPane.class); //right click to call the popup // http://javafx-jira.kenai.com/browse/JMY-179 scrollPane.mouse().click(1, scrollPane.wrap().getClickPoint(), MouseButtons.BUTTON3); //pushing a context menu is just like pushing main menu new ContextMenuDock().asMenuOwner().push("item _2"); scrollPane.mouse().click(1, scrollPane.wrap().getClickPoint(), MouseButtons.BUTTON3); //or new MenuItemDock(new ContextMenuDock().asMenuParent(), "sub-", StringComparePolicy.SUBSTRING).mouse().click(); }
protected void setScrollPane(ScrollPane seq) { this.sequence = seq; views = new VBox(); sequence.setContent(views); sequence.vvalueProperty().addListener(new ChangeListener<Number>() { /** * 無限ループ防止用 */ private boolean lock = false; public void changed(ObservableValue<? extends Number> arg0, Number arg1, Number arg2) { if (!lock) { if (viewtime >= 0) { lock = true; setViewCursor(viewtime); viewtime = -1; lock = false; } info.sequenceViewChanged(); } } }); }
/** * Prints the content of the tracking log into a new Stage. */ public void showOutput() { Text show = new Text(output()); ScrollPane window = new ScrollPane(); window.setContent(show); window.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); window.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); Scene scene = new Scene(window, 400, 600); Stage stage = new Stage(); stage.setTitle("Tracking history"); stage.setScene(scene); stage.show(); }
/** * Initialize fxml file. */ @Override public void initialize(URL arg0, ResourceBundle arg1) { scrollPane.addEventFilter(ScrollEvent.ANY, scrollEventHandler); loadData(); pane.boundsInParentProperty().addListener((observable, oldValue, newValue) -> { scrollPane.setPrefWidth(newValue.getWidth()); scrollPane.setPrefHeight(newValue.getHeight()); }); scrollPane.setHvalue(0); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); innerGroup = getAnnotations(); // innerGroup.scaleYProperty().bind(scrollPane.heightProperty().divide(innerGroup.getBoundsInLocal().getHeight())); outerGroup = new Group(innerGroup); scrollPane.setContent(outerGroup); }
public MemristorParametersUI(MemristorLibrary.Memristor_Model memristorType) { dm = new DialogsManager(); savedFileCount = 0; this.memristorType = memristorType; memristor = MemristorLibrary.GetNewMemristor(memristorType); selectedPreset = 0; simulationType = ResourcesMAF.MONTECARLO_SIMULATION; // Main GridPane GridPane gridPane = new GridPane(); gridPane.setPadding(new Insets(15, 15, 15, 15)); gridPane.setHgap(5); gridPane.setVgap(5); gridPane.setAlignment(Pos.CENTER); // Create UI RecreateParameterAndVariationsUI(gridPane, memristorType.index()); // Set content in scroll pane ScrollPane sp = new ScrollPane(); sp.setContent(gridPane); sp.setFitToHeight(true); sp.setFitToWidth(true); this.getChildren().add(sp); }
@Override public void start(Stage primaryStage) { try { MQTTConnector connection = new MQTTConnector("localhost", null, null); GuiController.setConnection(connection); rootLayout = (VBox)FXMLLoader.load(getClass().getResource("application.fxml")); GuiController.setRootPane(rootLayout); //rootLayout.getChildren().get(1); SplitPane n = (SplitPane) rootLayout.getChildren().get(1); ScrollPane sp = (ScrollPane) n.getItems().get(1); // sp.setContent(value); for(Node v :n.getItems()) { System.out.println("Node node " + v); } // Show the scene containing the root layout. Scene scene = new Scene(rootLayout); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } }
/** * Constructs a new {@link ThemeBuilderPanel}. * @param styling the {@link JavaFxStyle}. * @param shortcuts the {@link ThemeBuilderShortcutProperties}. * @param theme the {@link BuildWallTheme} to configure. */ ThemeBuilderPanel( JavaFxStyle styling, ThemeBuilderShortcutProperties shortcuts, BuildWallTheme theme ) { this.styling = styling; this.shortcuts = shortcuts; this.builderWall = new DisjointBuilderWall( theme ); this.add( builderWall, 0, 0 ); this.configurationPanel = new ThemeConfigurationPanel( theme, shortcuts ); this.scroller = new ScrollPane( configurationPanel ); this.scroller.setFitToWidth( true ); this.shortcutsPane = new TitledPane( SHORTCUTS_TITLE, new ThemeBuilderShortcutsPane( shortcuts ) ); styling.applyBasicPadding( shortcutsPane ); this.scrollerSplit = new BorderPane( scroller ); this.scrollerSplit.setTop( shortcutsPane ); this.add( scrollerSplit, 0, 1 ); this.styling.configureFullWidthConstraints( this ); }
@Override public double getSuggestedWidth() { if(this.getChildren().size() < 2) { return 0; } Node currentNode = this.getChildren().get(0); if(!(currentNode instanceof ScrollPane)) { return 0; } ScrollPane scrollPane = (ScrollPane)currentNode; Node content = scrollPane.getContent(); if(content == null) { return 0; } return ((Region)content).getWidth() + 50; }
@Test public void shouldHandleClickByInstructingController() { systemUnderTest.handleBeingSelected(); verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() ); assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) ); SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue(); assertThat( title.getTitle(), is( FontsTreeItem.TITLE ) ); assertThat( title.getDescription(), is( FontsTreeItem.DESCRIPTION ) ); assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) ); ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue(); assertThat( scroller.getContent(), is( instanceOf( FontsPanel.class ) ) ); FontsPanel panel = ( FontsPanel ) scroller.getContent(); assertThat( panel.hasConfiguration( configuration ), is( true ) ); }
@Test public void shouldHandleClickByInstructingController() { systemUnderTest.handleBeingSelected(); verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() ); assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) ); SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue(); assertThat( title.getTitle(), is( DimensionsTreeItem.TITLE ) ); assertThat( title.getDescription(), is( DimensionsTreeItem.DESCRIPTION ) ); assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) ); ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue(); assertThat( scroller.getContent(), is( instanceOf( DimensionsPanel.class ) ) ); DimensionsPanel panel = ( DimensionsPanel ) scroller.getContent(); assertThat( panel.hasConfiguration( configuration ), is( true ) ); }
@Test public void shouldHandleClickByInstructingController() { systemUnderTest.handleBeingSelected(); verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() ); assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) ); SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue(); assertThat( title.getTitle(), is( ColoursTreeItem.TITLE ) ); assertThat( title.getDescription(), is( ColoursTreeItem.DESCRIPTION ) ); assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) ); ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue(); assertThat( scroller.getContent(), is( instanceOf( ColoursPanel.class ) ) ); ColoursPanel panel = ( ColoursPanel ) scroller.getContent(); assertThat( panel.hasConfiguration( configuration ), is( true ) ); }