/** @param fp */ private void addItems(FlowPane fp) { for (StaffInfo staff : StaffWagesPersistence.wagesItems) { FlowPane horizontalPane = new FlowPane(Orientation.HORIZONTAL); horizontalPane.setHgap(30); horizontalPane.setAlignment(Pos.CENTER); final StaffInfo s = (StaffInfo) staff; // Items FLD ----------------------------------------------------------- TextField itemName = new TextField(); itemName.setMaxWidth(70); itemName.setText(s.staffName); itemName.setEditable(false); itemName.setPromptText("Item Name"); horizontalPane.getChildren().add(itemName); TextField itemPrice = new TextField(); itemPrice.setMaxWidth(70); itemPrice.setText(s.staffWages); itemPrice.setEditable(false); itemPrice.setPromptText("Price PKR"); horizontalPane.getChildren().add(itemPrice); Button saveButt = new Button("Delete"); horizontalPane.getChildren().add(saveButt); saveButt.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { StaffWagesPersistence.deleteStaff(s.staffName); primaryStage.close(); new StaffWagesDialog(); } }); fp.getChildren().add(horizontalPane); } }
/** * Creates a FlowPane layout with the specified orientation and hgap/vgap. * * @param orientation the direction the tiles should flow & wrap * @param hgap the amount of horizontal space between each tile * @param vgap the amount of vertical space between each tile * @param children The initial set of children for this pane. * @since JavaFX 8.0 */ public FlowPane(Orientation orientation, double hgap, double vgap, Node... children) { this(); setOrientation(orientation); setHgap(hgap); setVgap(vgap); getChildren().addAll(children); }
/** @param fp */ private void addItems(FlowPane fp) { for (CafeItemsInfo cafeItem : CafePricingPersistence.cafeItems) { FlowPane horizontalPane = new FlowPane(Orientation.HORIZONTAL); horizontalPane.setHgap(30); horizontalPane.setAlignment(Pos.CENTER); final CafeItemsInfo c = (CafeItemsInfo) cafeItem; // Items FLD ----------------------------------------------------------- TextField itemName = new TextField(); itemName.setMaxWidth(70); itemName.setText(c.itemName); itemName.setEditable(false); itemName.setPromptText("Item Name"); horizontalPane.getChildren().add(itemName); TextField itemPrice = new TextField(); itemPrice.setMaxWidth(70); itemPrice.setText(c.itemPrice + " Rs"); itemPrice.setEditable(false); itemPrice.setPromptText("Price PKR"); horizontalPane.getChildren().add(itemPrice); Button saveButt = new Button("Delete"); horizontalPane.getChildren().add(saveButt); saveButt.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { CafePricingPersistence.deleteCafeItems(c.itemName); primaryStage.close(); new CafePricingDialog(); } }); fp.getChildren().add(horizontalPane); } }
@Override public void initialize(URL arg0, ResourceBundle arg1) { initRectangle(); initLogo(); initTreeView(); initGenButton(); AddDbAction addDbAction = new AddDbAction(mItemMySql); for (int i = 0; i < 50; i++) { SelectLabel label = new SelectLabel("asd"); label.setWrapText(true); label.setGraphic(new ImageView(Context.Icon_Table2)); label.getStyleClass().add("label1"); flowPane.getChildren().add(label); } flowPane.setPadding(new Insets(5, 0, 0, 5)); flowPane.setVgap(5); flowPane.setHgap(5); flowPane.setMaxSize(200d, 200d); flowPane.autosize(); flowPaneRoot.getChildren().add(selection); }
private FlowPane createAssignedUserPane() { FlowPane assignedUserPane = new FlowPane(); assignedUserPane.setPadding(new Insets(5, 5, 5, 5)); assignedUserPane.setHgap(3); assignedUserPane.setVgap(5); assignedUserPane.setStyle("-fx-border-radius: 3;"); return assignedUserPane; }
@Override public void start(Stage primaryStage) { Image[] images = new Image[10]; for (int i = 0; i < 8; i++) { images[i] = new Image("de/javafxbuch/" + (i + 2) + "_of_hearts.png", 50, 72, true, true); } FlowPane iconView = new FlowPane(); iconView.setVgap(10); iconView.setHgap(20); for (int i = 0; i < images.length; i++) { iconView.getChildren().add(new ImageView(images[i])); } primaryStage.setScene(new Scene(new StackPane(iconView), 300, 200)); primaryStage.show(); }
@Override public void start(Stage primaryStage) { thestage = primaryStage; // can now use the stage in other methods // make things to put on panes btnscene1 = new Button("Click to go to Other Scene"); btnscene2 = new Button("Click to go back to First Scene"); btnscene1.setOnAction(e -> ButtonClicked(e)); btnscene2.setOnAction(e -> ButtonClicked(e)); lblscene1 = new Label("Scene 1"); lblscene2 = new Label("Scene 2"); // make 2 Panes pane1 = new FlowPane(); pane2 = new FlowPane(); pane1.setHgap(20); pane2.setVgap(10); // set background color of each Pane pane1.setStyle("-fx-background-color:tan;-fx-padding:10px;"); pane2.setStyle("-fx-background-color:red;-fx-padding:10px;"); // add everything to panes pane1.getChildren().addAll(lblscene1, btnscene1); pane2.getChildren().addAll(lblscene2, btnscene2); // make 2 scenes from 2 panes scene1 = new Scene(pane1, 200, 100); scene2 = new Scene(pane2, 200, 100); // make another stage for scene2 newStage = new Stage(); newStage.setScene(scene2); // tell stage it is meannt to pop-up (Modal) newStage.initModality(Modality.APPLICATION_MODAL); newStage.setTitle("Pop up window"); // rest of code - primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene1); primaryStage.setMinWidth(300); primaryStage.show(); }
/** * Creates a horizontal FlowPane layout with the specified hgap/vgap. * * @param hgap the amount of horizontal space between each tile * @param vgap the amount of vertical space between each tile * @param children The initial set of children for this pane. * @since JavaFX 8.0 */ public FlowPane(double hgap, double vgap, Node... children) { this(); setHgap(hgap); setVgap(vgap); getChildren().addAll(children); }
/** * Creates a FlowPane layout with the specified orientation and hgap/vgap. * * @param orientation the direction the tiles should flow & wrap * @param hgap the amount of horizontal space between each tile * @param vgap the amount of vertical space between each tile */ public FlowPane(Orientation orientation, double hgap, double vgap) { this(); setOrientation(orientation); setHgap(hgap); setVgap(vgap); }
/** * Creates a horizontal FlowPane layout with the specified hgap/vgap. * * @param hgap the amount of horizontal space between each tile * @param vgap the amount of vertical space between each tile */ public FlowPane(double hgap, double vgap) { this(); setHgap(hgap); setVgap(vgap); }
@Override public void start(Stage stage) { stage.setTitle("FX Keyboard (" + System.getProperty("javafx.runtime.version") + ")"); stage.setResizable(true); popup = KeyBoardPopupBuilder.create() .initLocale(Locale.ENGLISH) .addIRobot(RobotFactory.createFXRobot()) .build(); popup .getKeyBoard() .setOnKeyboardCloseButton( new EventHandler<Event>() { public void handle(Event event) { setPopupVisible(false, null); } }); FlowPane pane = new FlowPane(); pane.setVgap(20); pane.setHgap(20); pane.setPrefWrapLength(100); final TextField tf = new TextField(""); final TextArea ta = new TextArea(""); Button okButton = new Button("Ok"); okButton.setDefaultButton(true); Button cancelButton = new Button("Cancel"); cancelButton.setCancelButton(true); pane.getChildren().add(new Label("Text1")); pane.getChildren().add(tf); pane.getChildren().add(new Label("Text2")); pane.getChildren().add(ta); pane.getChildren().add(okButton); pane.getChildren().add(cancelButton); // pane.getChildren().add(KeyBoardBuilder.create().addIRobot(RobotFactory.createFXRobot()).build()); Scene scene = new Scene(pane, 200, 300); // add keyboard scene listener to all text components scene .focusOwnerProperty() .addListener( new ChangeListener<Node>() { @Override public void changed(ObservableValue<? extends Node> value, Node n1, Node n2) { if (n2 != null && n2 instanceof TextInputControl) { setPopupVisible(true, (TextInputControl) n2); } else { setPopupVisible(false, null); } } }); String css = this.getClass().getResource("/css/KeyboardButtonStyle.css").toExternalForm(); scene.getStylesheets().add(css); stage.setOnCloseRequest( new EventHandler<WindowEvent>() { public void handle(WindowEvent event) { System.exit(0); } }); popup.show(stage); stage.setScene(scene); stage.show(); }
public BoardView(int noPlayers, final Stage primaryStage) { window = primaryStage; window.setTitle("Quoridor"); window.setMaxHeight(1280); window.setMaxWidth(1280); window.setResizable(false); BorderPane border = new BorderPane(); infoPane = new FlowPane(); infoPane.setPadding(new Insets(10)); infoPane.setHgap(40); infoPane.setVgap(10); infoPane.setOrientation(Orientation.HORIZONTAL); bottomPane = new HBox(); bottomPane.setSpacing(345); gameGrid = new GridPane(); gameGrid.setPadding(new Insets(4)); gameGrid.setId("gamegrid"); border.setTop(infoPane); border.setCenter(gameGrid); playerPositionButtons = new PlayerPositionButton[9][9]; wallPositionButtons = new WallPositionButton[9][8]; horizontalWalls = new Pane[9][9]; verticalWalls = new Pane[9][9]; column = 0; row = 0; chooseVertical = new Button(); chooseVertical.setPrefSize(100, 100); chooseVertical.setId("vWallBtn"); Button home = new Button(); home.setPrefSize(100, 100); home.setId("home"); home.setOnAction(e -> confirmBox()); bottomPane.getChildren().addAll(chooseVertical, home); border.setBottom(bottomPane); border.setMargin(bottomPane, new Insets(40, 40, 20, 20)); for (int y = 0; y < 8; y++) { createMoveLine(y); createWallLine(y); } createMoveLine(8); main = new Scene(border, 600, 768); main.getStylesheets().add("gameplay/viewJFX/" + stylesheet); buildPlayerLabels(noPlayers); window.setScene(main); window.show(); }
private FlowPane addBucket(int column) { FlowPane bucket = new FlowPane(); bucket.setHgap(5); add(bucket, column, STORIES_ROW); return bucket; }
public SerieInfo(final Serie serie) { // TODO Auto-generated constructor stub GridPane grid = new GridPane(); FlowPane flow = new FlowPane(Orientation.HORIZONTAL); flow.setAlignment(Pos.TOP_LEFT); flow.setHgap(40); DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(10); dropShadow.setOffsetY(10); dropShadow.setColor(Color.rgb(50, 50, 50, 0.7)); Label poster = new Label(); String style_inner = "-fx-font: Gill Sans;" + "-fx-font-family: Gill Sans;" + "-fx-effect: dropshadow(one-pass-box, black, 8, 0, 4, 4);"; poster.setStyle(style_inner); final Label star = new Label(); Image stella = new Image("img/greentick.png", 35, 35, true, true, true); star.setGraphic(new ImageView(stella)); star.setVisible(false); ImageView image = new ImageView(serie.getPoster()); poster.setGraphic(image); TextArea text = new TextArea(); text.setPrefSize(600, 160); text.setText(serie.getOverview()); text.setWrapText(true); text.setEditable(false); /* * text.setStyle("-fx-text-fill: black;"+ "-fx-font: Gill Sans;"+ * "-fx-font-size: 13;" + "-fx-height:400"); */ text.setStyle(LABEL_STYLE); String name = null; if (serie.getNome().length() > 16) { name = serie.getNome().substring(0, 15); name = name.concat("..."); } else { name = serie.getNome(); } Label nome = new Label(name); nome.setTextFill(Color.BLACK); nome.setFont(Font.font("Helvetica", 28)); final Button btn = new Button(" Add "); ImageView imageview = new ImageView(new Image("img/add.png", 12, 12, true, true, true)); btn.setGraphic(imageview); btn.setContentDisplay(ContentDisplay.LEFT); /* * String buttonCss = SerieInfo.class.getResource("CustomButton.css") * .toExternalForm(); btn.getStylesheets().add(buttonCss); */ btn.getStyleClass().add("custom-browse"); btn.setCursor(Cursor.HAND); btn.setTextFill(Color.WHITE); btn.addEventHandler( MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { star.setVisible(true); if (Preferiti.getInstance().addToPreferiti(serie) == false) { /* * new MyDialog(Guiseries2.stage, * Modality.APPLICATION_MODAL, "Warning!", serie); */ } else { btn.setDisable(true); btn.setText(" Added "); btn.setGraphic(null); // torrent... DaemonManager manager = new DaemonManager(); Search search = new Search( serie, manager, "ENG", new SearchListener() { @Override public void SearchListener() { Platform.runLater( new Runnable() { @Override public void run() { boolean compare = false; for (int i = 0; i < serie.getStagioni().size(); i++) { for (int j = 0; j < serie.getStagioni().get(i).getEpisodiStagione().size(); j++) { compare = false; if ((serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent() != null)) { for (int k = (1 + j); k < serie .getStagioni() .get(i) .getEpisodiStagione() .size(); k++) { if (serie .getStagioni() .get(i) .getEpisodiStagione() .get(k) .getTorrent() != null) { if (serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent() .getName() .equals( serie .getStagioni() .get(i) .getEpisodiStagione() .get(k) .getTorrent() .getName())) { compare = true; } } } if (compare == false) { TorrentSeriesElement.getInstance() .addToTorrents( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent()); if ((TorrentSeriesElement.getInstance() .torrents .indexOf( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent()) % 2) == 0) { TabDownload.mainDownload .getChildren() .add( TabDownload.addTorrentEvenToDownloadTab( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent())); } else { TabDownload.mainDownload .getChildren() .add( TabDownload.addTorrentOddToDownloadTab( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent())); } System.out.println( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent() .getName()); } } } } try { FilmistaDb.getInstance().addSeriesToFilmistaDb(serie); } catch (ClassNotFoundException e1) { // TODO Auto-generated // catch // block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated // catch // block e1.printStackTrace(); } catch (SQLException e1) { // TODO Auto-generated // catch // block e1.printStackTrace(); } TabPreferiti.updateTab(); } }); } }); } } }); flow.getChildren().add(btn); flow.getChildren().add(nome); if (Preferiti.getInstance().series.contains(serie) == true) { btn.setText(" Added "); btn.setDisable(true); star.setVisible(true); btn.setGraphic(null); } grid.setHgap(25); grid.setVgap(15); grid.add(poster, 0, 0, 1, 2); grid.add(flow, 1, 0); FlowPane paneStar = new FlowPane(Orientation.HORIZONTAL); paneStar.setAlignment(Pos.TOP_RIGHT); paneStar.getChildren().add(star); grid.add(paneStar, 2, 0, 1, 1); grid.add(text, 1, 1, 2, 1); grid.getColumnConstraints().add(0, new ColumnConstraints()); grid.getColumnConstraints().add(1, new ColumnConstraints()); grid.getColumnConstraints().add(2, new ColumnConstraints(150)); // grid.setGridLinesVisible(true); grid.setHgrow(text, Priority.ALWAYS); grid.setVgrow(poster, Priority.ALWAYS); grid.setPadding(new Insets(25, 25, 25, 25)); this.setCenter(grid); String customCss = SerieInfo.class.getResource("CustomBorder.css").toExternalForm(); this.getStylesheets().add(customCss); this.getStyleClass().add("custom-border"); }
private FlowPane buildLowerArea() { FlowPane flow = new FlowPane(); flow.setPadding(new Insets(10, 10, 10, 10)); flow.prefHeightProperty().bind(this.heightProperty()); flow.prefWidthProperty().bind(this.widthProperty()); flow.setVgap(8); flow.setHgap(4); Button startDebbtn = new Button("Start New Debate"); startDebbtn.setPrefSize(150, 50); Button judger1btn = new Button("Judge Round 1"); judger1btn.setDisable(true); judger1btn.setPrefSize(150, 50); Button judger2btn = new Button("Judge Round 2"); judger2btn.setDisable(true); judger2btn.setPrefSize(150, 50); Button judger3btn = new Button("Judge Round 3"); judger3btn.setDisable(true); judger3btn.setPrefSize(150, 50); Button judger4btn = new Button("Judge Round 4"); judger4btn.setDisable(true); judger4btn.setPrefSize(150, 50); Button finalResbtn = new Button("Final Result"); finalResbtn.setDisable(true); finalResbtn.setPrefSize(150, 50); Hyperlink termhp = new Hyperlink("Terminate Current Match/Start New"); flow.getChildren() .addAll(startDebbtn, judger1btn, judger2btn, judger3btn, judger4btn, finalResbtn, termhp); termhp.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { judger1btn.setDisable(true); judger2btn.setDisable(true); judger3btn.setDisable(true); judger4btn.setDisable(true); finalResbtn.setDisable(true); } }); startDebbtn.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { new MatchManager().StartMatch(); } }); return flow; }