public FlowPaneSample() { super(400, 400); FlowPane flowPane = new FlowPane(2, 4); flowPane.setPrefWrapLength(200); //preferred wraplength Label[] shortLabels = new Label[ITEMS]; Label[] longLabels = new Label[ITEMS]; ImageView[] imageViews = new ImageView[ITEMS]; for (int i = 0; i < ITEMS; i++) { shortLabels[i] = new Label("Short label."); longLabels[i] = new Label("I am a slightly longer label."); imageViews[i] = new ImageView(ICON_48); flowPane.getChildren().addAll(shortLabels[i], longLabels[i], imageViews[i]); } getChildren().add(flowPane); }
public static Node createIconContent() { StackPane sp = new StackPane(); FlowPane fp = new FlowPane(); fp.setAlignment(Pos.CENTER); Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY); rectangle.setStroke(Color.BLACK); fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight()); Rectangle[] littleRecs = new Rectangle[4]; Rectangle[] bigRecs = new Rectangle[4]; for (int i = 0; i < 4; i++) { littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4")); bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00")); fp.getChildren().addAll(littleRecs[i], bigRecs[i]); FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2)); } sp.getChildren().addAll(rectangle, fp); return new Group(sp); }
@Override public void start(Stage stage) throws Exception { ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList( new PieChart.Data("Education", 200), new PieChart.Data("Health", 130), new PieChart.Data("Defense", 200), new PieChart.Data("Agriculture", 200) ); PieChart budget = new PieChart(pieChartData); budget.setTitle("Economy Divison"); FlowPane root = new FlowPane(); root.getChildren().add(budget); Scene scene = new Scene(root,500,500); stage.setTitle("Pie Chart Demo"); stage.setScene(scene); stage.show(); }
private void buildForm(Stage primaryStage) { textAreaClassifiableText = new TextArea(); textAreaClassifiableText.setWrapText(true); btnClassify = new Button("Classify"); btnClassify.setOnAction(new ClassifyBtnPressEvent()); lblCharacteristics = new Label(""); root = new FlowPane(Orientation.VERTICAL, 10, 10); root.setAlignment(Pos.BASELINE_CENTER); root.getChildren().addAll(textAreaClassifiableText, btnClassify, lblCharacteristics); primaryStage.setScene(new Scene(root, 500, 300)); primaryStage.show(); }
@Override public void start(Stage primaryStage) throws Exception { Platform.setImplicitExit(true); SearchTreePaneController paneBuilder = new SearchTreePaneController(conceptService, uiBundle); BorderPane node = paneBuilder.getRoot(); FlowPane pane = new FlowPane(); pane.setPrefSize(800, 250); DragPaneDecorator dragPaneDecorator = new DragPaneDecorator(conceptService, eventBus, uiBundle); dragPaneDecorator.decorate(pane); node.setBottom(pane); Scene scene = new Scene(node, 800, 800); scene.getStylesheets().add("/css/common.css"); primaryStage.setScene(scene); primaryStage.show(); primaryStage.setOnCloseRequest(e -> { Platform.exit(); System.exit(0); }); }
@Test public void testExceptionHelp() throws Exception { App app = App.getInstance(OBDMain.APP_PATH); String exception = "java.net.BindException:Address already in use (Bind failed)"; ExceptionHelp ehelp = app.getExceptionHelpByName(exception); assertNotNull(ehelp); FlowPane fp = new FlowPane(); Label lbl = new Label(I18n.get(ehelp.getI18nHint())); Hyperlink link = new Hyperlink(ehelp.getUrl()); fp.getChildren().addAll(lbl, link); SampleApp sampleApp = new SampleApp("help", fp); final Linker linker = sampleApp; link.setOnAction((evt) -> { linker.browse(link.getText()); }); sampleApp.show(); sampleApp.waitOpen(); Thread.sleep(SHOW_TIME); sampleApp.close(); }
/** * @param tab * @param btn_clear_directions * @param btn_show_directions * @param btn_find_path * @param btn_clear_path * @param path_choice_pane * @param btn_get_coords_find_path * @param txt_from * @param txt_to */ public void createSimpleMap(final Tab tab, final FlowPane flowPane, final Button btn_clear_directions, final Button btn_show_directions, final Button btn_find_path, final Button btn_clear_path, final Pane path_choice_pane, final Button btn_get_coords_find_path, final TextField txt_from, final TextField txt_to) { //generates google map with some defaults and put it into top pane mapComponent = new GoogleMapView("/html/maps.html"); mapComponent.addMapInializedListener(this); mapComponent.addMapReadyListener(MOUSE_CLCK_FOR_GET_COORD_LISTENER); initControls(btn_clear_directions, btn_show_directions, btn_find_path, btn_clear_path, path_choice_pane, btn_get_coords_find_path, txt_from, txt_to); mapComponent.getChildren().addAll(flowPane, path_choice_pane); tab.setContent(mapComponent); }
private FlowPane getCenterPane() { FlowPane timerLabelPane = new FlowPane(); timerLabelPane.getChildren().add(timerLabel); timerLabelPane.setVgap(10); timerLabelPane.setAlignment(Pos.CENTER); FlowPane taskLabelPane = new FlowPane(); taskLabelPane.getChildren().addAll(currentTaskLabel, selectedTaskLabel); taskLabelPane.setVgap(10); taskLabelPane.setAlignment(Pos.CENTER); FlowPane taskPane = new FlowPane(); taskPane.setHgap(10); taskPane.setVgap(10); taskPane.setAlignment(Pos.CENTER); taskPane.getChildren().add(setTaskButton); taskPane.getChildren().add(taskLabelPane); FlowPane centerPane = new FlowPane(); centerPane.setOrientation(Orientation.VERTICAL); centerPane.setVgap(10); centerPane.setAlignment(Pos.CENTER); centerPane.getChildren().add(timerLabelPane); centerPane.getChildren().add(taskPane); return centerPane; }
private void mergeFailed(Exception exception) { Platform.runLater(() -> { Text text = new Text( String.format("Merging failed.\nProblem: %s\nIf you think this is a bug, please report it here:", exception.getMessage())); text.setWrappingWidth(CONTENT_WIDTH); text.setFill(Color.WHITE); // XXX: Ugly workaround because CSS doesn't work Hyperlink link = buildBugReportLink(exception); FlowPane content = new FlowPane(text, link); ThemedAlert alert = new ThemedAlert(AlertType.ERROR); alert.getDialogPane().setContent(content); alert.showAndWait(); System.exit(1); }); }
@Override public Node drawNode() { pane = baseFill(new FlowPane()); pane.setHgap(10); if (pane.getHgap() != 10) { reportGetterFailure("FlowPane.getHgap()"); } pane.setColumnHalignment(HPos.LEFT); pane.setRowValignment(VPos.TOP); pane.setAlignment(Pos.BOTTOM_LEFT);//.setVpos(VPos.BOTTOM); if (pane.getAlignment() != Pos.BOTTOM_LEFT) { reportGetterFailure("FlowPane.getAlignment()"); } return pane; }
@Override public void decorate(Node control, Pane container) { super.decorate(control, container); control.setStyle(control.getStyle() + "-fx-border-color: green;-fx-hgap:5;-fx-vgap:5;"); FlowPane flow = ((FlowPane) control); flow.getChildren().clear(); if (vside != null) { flow.getChildren().addAll(new Rectangle(50, 50, Color.RED), new Rectangle(20, 20, Color.GREEN)); flow.setOrientation(Orientation.HORIZONTAL); } if (hside != null) { flow.getChildren().addAll(new Rectangle(100, 50, Color.RED), new Rectangle(20, 20, Color.GREEN)); flow.setOrientation(Orientation.VERTICAL); } }
public void start(Stage stage){ WebView view = new WebView(); view.setPrefSize(PREF_WIDTH, PREF_HEIGHT); view.setId(VIEW_ID); FlowPane pane = new FlowPane(); pane.getChildren().add(view); final Scene scene = new Scene(pane); stage.setTitle(VIEW_ID); stage.setScene(scene); stage.sizeToScene(); stage.show(); System.out.println("Width:" + view.getWidth()); System.out.println("Height:" + view.getHeight()); }
public ButtonChooser(int a_width, boolean showAdditionalActionButton, SelectActionProvider a_selectActionProvider) { width = a_width; selectActionProvider = a_selectActionProvider; buttons = new FlowPane(); buttons.setMaxWidth(width); buttons.setMinWidth(width); if (showAdditionalActionButton) { additionalActionButton = new Utils.TextButton(AdditionalActionButtonTxt, null); buttons.getChildren().add(additionalActionButton); additionalActionButton.setTextHandler(new EventHandler<MouseEvent>() { public void handle(MouseEvent t) { if (null != selectedTestNode) { selectedTestNode.additionalAction(); } } }); } }
/** * Setup the tools tab. * @param toolTab */ private void setupTools(Tab toolTab) { FlowPane flow = new FlowPane(); flow.setAlignment(Pos.CENTER); flow.setHgap(5); flow.setVgap(5); for(final EditorDefinition definition : EditorDefinition.values()) { final Button button = new Button(definition.getName()); button.setMinWidth(150); button.setMinHeight(50); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { if(!editors.containsKey(definition)) addEditor(definition); } }); flow.getChildren().add(button); } toolTab.setContent(flow); }
public static void errorAlert(String title, String header) { GuiUtils.runSafe(() -> { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(title); alert.setHeaderText(header); String url = "https://github.com/OTBProject/OTBProject/issues"; FlowPane outer = new FlowPane(); FlowPane inner = new FlowPane(); Hyperlink link = new Hyperlink("here"); link.setOnAction((evt) -> DESKTOP_SERVICE.execute(() -> { try { Desktop.getDesktop().open(new File(FSUtil.logsDir())); } catch (IOException e) { App.logger.catching(e); } })); outer.getChildren().addAll(new Label("Please report this problem to the developers at"), new Label('"' + url + '"'), inner, new Label("(in the \"logs\" folder in your installation directory)")); inner.getChildren().addAll(new Label("and give them the log file \"app.log\" found"), link); alert.getDialogPane().contentProperty().set(outer); showErrorAlert(alert, url); }); }
private VBox getAttributionLinksForAboutDialog() { FlowPane iconsAttributionPane = generateLabelAndLinkPane("All icons (except for ", "http://icons8.com", Font.getDefault().getSize()); Label labelToAdd = new Label(") are from"); labelToAdd.setGraphic(new ImageView(new Image(applicationIcon16Location))); labelToAdd.setContentDisplay(ContentDisplay.LEFT); labelToAdd.setGraphicTextGap(2); iconsAttributionPane.getChildren().add(1, labelToAdd); //add the label in the middle of the message FlowPane softwareAttributionPane = generateLabelAndLinkPane("Click", Main.attributionHTMLLocation, Font.getDefault().getSize()); Hyperlink tempLink = (Hyperlink) softwareAttributionPane.getChildren().get(1); tempLink.setText("here"); softwareAttributionPane.getChildren().add(new Label("to see which software libraries are used in Who What Where.")); VBox vbox = new VBox(); vbox.getChildren().addAll(iconsAttributionPane, softwareAttributionPane); return vbox; }
private void FillNamedColorList(FlowPane pane, ArrayList<NamedColor> colors) { for (NamedColor c : colors) { Button b = new Button(); pane.getChildren().add(b); Rectangle r = new Rectangle(20, 20); r.setFill(c.Color); r.setStroke(Color.SILVER); Pane p = new Pane(); p.getChildren().add(r); b.setGraphic(p); b.setTooltip(new Tooltip(c.Name)); b.setOnAction(o -> { _color = c.Color; _stage.close(); }); } }
/** * Creates a content pane depending of the type passed in parameter. * * @param object * @return a new Pane */ public static <T> Pane getContentPane(T object){ if(object instanceof MethodRepTemplate){ return new FlowPane(10.0,10.0); } else if(object instanceof ConstructorRepTemplate){ return new FlowPane(10.0,10.0); } else if(object instanceof PropRepTemplate){ return new FlowPane(10.0,10.0); } /* else if(object instanceof ParamRepTemplate){ return new VBox(10.0); }*/ else{ return new VBox(10.0); } }
@Override public Node adjust(Node node, double scale) { requireNonNull(node); requireValidScale(scale); if (node instanceof FlowPane) { FlowPane flowPane = (FlowPane) node; flowPane.prefWrapLengthProperty().set(multiplyByScale(flowPane.prefWrapLengthProperty().get(), scale)); flowPane.hgapProperty().set(flowPane.hgapProperty().multiply(scale).get()); flowPane.vgapProperty().set(flowPane.vgapProperty().multiply(scale).get()); } return super.adjust(node, scale); }
private void init(Stage primaryStage) { VBox root = new VBox(); fpsLabel = new Label("FPS:"); fpsLabel.setStyle("-fx-font-size: 5em;-fx-text-fill: red;"); fpsLabel.setOnMouseClicked((event) -> { tracker.resetAverageFPS(); }); FlowPane flow = new FlowPane(); flow.setCache(true); flow.setCacheHint(CacheHint.SPEED); root.getChildren().addAll(fpsLabel,flow); Scene scene = new Scene(root, 500, 2000); createPerformanceTracker(scene); primaryStage.setScene(scene); List< ScatterChart<Number, Number>> result = new ArrayList<>(); for(int i =0; i<10;i++) { ScatterChart<Number, Number> tmp = createChart(); result.add(tmp); } flow.getChildren().setAll(result); }
@Override protected void updateItem(Set<String> labels, boolean empty) { super.updateItem(labels, empty); if (!empty) { FlowPane pane = new FlowPane(); for (String label : labels) { Button button = new Button(label); button.setStyle("-fx-color: " + this.colorCode(label.hashCode())); button.setOnAction(this::handle); pane.getChildren().add(button); } this.setGraphic(pane); this.setText(null); } else { this.setGraphic(null); this.setText(null); } }
private void addCheckboxes() { Label evidenceLabel = addLabel(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.evidence"), 10); GridPane.setValignment(evidenceLabel, VPos.TOP); CheckBox tamperProofCheckBox = new AutoTooltipCheckBox(Res.get("disputeSummaryWindow.evidence.tamperProof")); CheckBox idVerificationCheckBox = new AutoTooltipCheckBox(Res.get("disputeSummaryWindow.evidence.id")); CheckBox screenCastCheckBox = new AutoTooltipCheckBox(Res.get("disputeSummaryWindow.evidence.video")); tamperProofCheckBox.selectedProperty().bindBidirectional(disputeResult.tamperProofEvidenceProperty()); idVerificationCheckBox.selectedProperty().bindBidirectional(disputeResult.idVerificationProperty()); screenCastCheckBox.selectedProperty().bindBidirectional(disputeResult.screenCastProperty()); FlowPane checkBoxPane = new FlowPane(); checkBoxPane.setHgap(20); checkBoxPane.setVgap(5); checkBoxPane.getChildren().addAll(tamperProofCheckBox, idVerificationCheckBox, screenCastCheckBox); GridPane.setRowIndex(checkBoxPane, rowIndex); GridPane.setColumnIndex(checkBoxPane, 1); GridPane.setMargin(checkBoxPane, new Insets(10, 0, 0, 0)); gridPane.getChildren().add(checkBoxPane); }
@Test public void showLabeLPicker_clickSuggestedLabel_labelDisplayedCorrectly() { TurboIssue issue = new TurboIssue("dummy/dummy", 1, ""); triggerLabelPicker(issue); waitUntilNodeAppears(ASSIGNED_LABELS_PANE_ID); clickOn(IdGenerator.getLabelPickerTextFieldIdReference()); type("hig"); clickOn("high"); FlowPane assignedLabels = GuiTest.find(ASSIGNED_LABELS_PANE_ID); Node secondLabel = assignedLabels.getChildren().get(1); assertTrue(secondLabel instanceof Label); assertEquals("p.high", ((Label) secondLabel).getText()); // it's not removed assertFalse(secondLabel.getStyleClass().contains("labels-removed")); exitCleanly(); }
public TestPane() { Label l = new Label("Ein JavaFX Dialog"); l.setFont(font(50)); Button one = new Button("Open another Dialog"); one.setOnAction((e) -> Ui.exec(() -> { Ui.build(l).fx().eval(() -> new RevenueReportSelectorPane()).ifPresent(System.out::println); })); Button two = new Button("Ok (Close this dialog)"); two.setOnAction(e -> { ok = true; Ui.closeWindowOf(this); }); setCenter(l); setBottom(new FlowPane(one, two)); }
public NodeControlPane(Core core) { super(); this.core = core; TabPane tab = new TabPane(); tab.getTabs().add(newIndexTab()); tab.getTabs().add(newWikiTab()); tab.getTabs().add(newSpacetimeTab()); tab.getTabs().add(newSpaceTab()); tab.getTabs().add(newTimeTab()); tab.getTabs().add(newOptionsTab()); tab.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE); tab.autosize(); setCenter(tab); FlowPane menu = new FlowPane(); menu.getChildren().add(newAddButton()); menu.getChildren().add(newBrowserButton()); setBottom(menu); }
@Override public void start(Stage stage) throws Exception { root = new FlowPane(); root.setVgap(10); root.setHgap(10); Scene scene = new Scene(root, Color.LINEN); stage.setTitle("Multi Line Table Cell Demo"); stage.setWidth(800); stage.setHeight(500); stage.setScene(scene); scene.getStylesheets().add("styles/sample.css"); showMultiLineTable(); showEmptyRowTable(); stage.show(); }
public TokenInputSearchFlowControl() { super(); this.content = this; setPadding(new Insets(3)); setSpacing(3); getStyleClass().add("tokenInput"); itemsFlowBox = new FlowPane(); itemsFlowBox.setVgap(6); itemsFlowBox.setPadding(new Insets(2,0,2,0)); StringBuilder sb = new StringBuilder("-fx-background-color:linear-gradient(from 0px -19px to 0px 0px , repeat, #EEEEEE 76% , #CCC9C1 79% , #FFF0C7 89% );"); sb.append("-fx-border-color:#CCC9C1;"); sb.append("-fx-border-width:0px 1.5px 0px 1.5px;"); sb.append("-fx-border-style: segments(62,14) phase 35;"); itemsFlowBox.setStyle(sb.toString()); getChildren().add(StackPaneBuilder.create().children(itemsFlowBox).style("-fx-background-color:#FFF0C7").padding(new Insets(0,10,3,10)).build()); configureSearchField(); }
/** * {@inheritDoc} */ @Override protected void initView() { // final FlowPane fp = FlowPaneBuilder.create() // .children(new ImageView(MTImages.MT_TITLE.get())) // .build(); // fp.setAlignment(Pos.CENTER); this.topPane = new FlowPane(Orientation.VERTICAL); this.topPane.setPrefHeight(100); node().setTop(this.topPane); node().setCenter(buildGameConfigPanel()); // getRootNode().setBottom(buildStartGamePanel()); // Ui binding final BooleanBinding bb1 = Bindings.or(this.addition.selectedProperty(), this.subtraction.selectedProperty()); final BooleanBinding bb2 = Bindings.or(this.multiplication.selectedProperty(), this.division.selectedProperty()); final BooleanBinding bb = Bindings.or(bb1, bb2); this.playButton.disableProperty().bind(bb.and(this.lengthGroup.selectedToggleProperty().isNotNull()).not()); }
/** * Builds the start game panel. * * @return the node */ private Node buildStartGamePanel() { final FlowPane fp = new FlowPane(); this.playButton = ButtonBuilder.create().id("playButton") .styleClass("play") .minHeight(130) .minWidth(180) // .text("Start Game") .build(); fp.getChildren().add(this.playButton); fp.setAlignment(Pos.TOP_CENTER); return fp; }
private void addRoom(int roomId, Room room) { final RoomView roomView = new RoomView(roomId, room); roomView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { if (selectRoom != null) { selectRoom.setStyle("-fx-border-color: white;"); } roomView.setStyle("-fx-border-color: red;"); selectRoom = roomView; } }); FlowPane.setMargin(roomView, new Insets(20, 0, 0, 40)); roomList.getChildren().add(roomView); }
private Tab buildJavascriptPane() { final ScrollPane scroll=new ScrollPane(super.javascriptArea); scroll.setFitToWidth(true); scroll.setFitToHeight(true); final BorderPane pane=new BorderPane(scroll); pane.setPadding(new Insets(10)); final FlowPane top=new FlowPane(); top.getChildren().addAll(super.makeJavascriptButtons()); pane.setTop(top); final FlowPane bottom=new FlowPane( new TextFlow(new Text("The script injects:\n"+ "* '"+HEADER_CONTEXT_KEY+"' an instance of "),javadocFor(SAMFileHeader.class),new Text("\n"+ "* '"+RECORD_CONTEXT_KEY+"' an instance of "),javadocFor(SAMRecord.class),new Text("\n"+ "* '"+TOOL_CONTEXT_KEY+"' an instance of "),javadocFor(BamTools.class),new Text("\n"+ "The script should return a boolean: true (accept record) or false (reject record)") )); pane.setBottom(bottom); final Tab tab=new Tab(JAVASCRIPT_TAB_KEY,pane); tab.setClosable(false); return tab; }
/** * Loops through the property file grabbing the proper labels * * @return HBox of label/combo-box pairs */ protected Node getHBox () { FlowPane pane = new FlowPane(); setSize(pane, Double.parseDouble(mySize.getString("MaxWrap"))); pane.setVgap(CUSHION); pane.setVgap(CUSHION); for (int i = 0; i < myNodes.size(); i++) { String label = myLabels.getString(getLabelKey(Integer.toString(i))); pane.getChildren().add(getCombo(label, myNodes.get(i))); } return pane; }
private void createGameDisplay () { myGameDisplay = new FlowPane(); myGameDisplay.setVgap(Double.parseDouble(myBundle.getString("Vgap"))); myGameDisplay.setHgap(Double.parseDouble(myBundle.getString("Hgap"))); myGameDisplay.setId(myBundle.getString("gamedisplayID")); myLayout.setCenter(myGameDisplay); }
@Override public void start(Stage primaryStage) throws Exception { Rotate rotate = new Rotate(); JFXButton button = new JFXButton("Rotation"); button.getTransforms().add(rotate); button.addEventHandler(MouseEvent.MOUSE_CLICKED, e ->{ angle += 10; rotate.setAngle(angle); rotate.setPivotX(button.getWidth()/2); rotate.setPivotY(button.getHeight()/2); }); FlowPane root = new FlowPane(); root.setAlignment(Pos.CENTER); root.setPadding(new Insets(25,25,25, angle)); root.getChildren().add(button); Scene scene = new Scene(root,300,250); primaryStage.setTitle("Button Animation"); primaryStage.setScene(scene); primaryStage.show(); }
@Override public void start(final Stage primaryStage) throws Exception { MediaView mediaView = new MediaView(); Media media = new Media(new File("credits/end_scene.mp4").toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaView.setMediaPlayer(mediaPlayer); mediaPlayer.setAutoPlay(true); mediaView.setPreserveRatio(false); List<String> params = getParameters().getRaw(); if(params.size() == 2) { mediaView.setFitWidth(Integer.parseInt(params.get(0))); mediaView.setFitHeight(Integer.parseInt(params.get(1))); } else { mediaView.setFitWidth(1280); mediaView.setFitHeight(720); } mediaPlayer.setOnEndOfMedia(new Runnable() { @Override public void run() { primaryStage.close(); } }); primaryStage.setScene(new Scene(new FlowPane(mediaView))); primaryStage.show(); }