/** DEFAULT. */ public CafePricingDialog() { this.priceMap = new HashMap<>(); this.primaryStage = new Stage(); this.root = new Group(); this.scrollPane = new ScrollPane(); this.scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); this.scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); this.scene = new Scene(scrollPane, 0x190, 0x1f4, Color.LIGHTGREY); makeDialog(fp); fp.setMinSize(380, 480); fp.setAlignment(Pos.TOP_CENTER); bp.setTop(logoChildBP); bp.setCenter(labelChildBP); bp.setBottom(fp); root.getChildren().add(bp); scrollPane.setContent(root); // -------------------------------------------- this.primaryStage.setTitle(TITLE); this.primaryStage.setScene(scene); this.primaryStage.setResizable(false); this.primaryStage.show(); }
public void start(Stage stage) { stage.setTitle("ListView demo"); FlowPane rootNode = new FlowPane(10, 10); rootNode.setAlignment(Pos.CENTER); Scene scene = new Scene(rootNode, 200, 120); stage.setScene(scene); responseLabel = new Label("Select Transport Type"); ObservableList<String> transportTypes = FXCollections.observableArrayList("Train", "Car", "Airplane"); ListView<String> transportListView = new ListView(transportTypes); transportListView.setPrefSize(80, 80); MultipleSelectionModel<String> listViewSelectionModel = transportListView.getSelectionModel(); listViewSelectionModel .selectedItemProperty() .addListener( new ChangeListener<String>() { public void changed( ObservableValue<? extends String> changed, String oldValue, String newValue) { responseLabel.setText("Transport selected is " + newValue); } }); rootNode.getChildren().addAll(transportListView, responseLabel); stage.show(); }
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 initialize(URL location, ResourceBundle resources) { // canvas background bgGC = bgCanvas.getGraphicsContext2D(); bgCanvasContainer.getChildren().add(bgCanvas); // canvas figure fgGC = fgCanvas.getGraphicsContext2D(); fgCanvasContainer.getChildren().add(fgCanvas); // canvas design dgGC = dgCanvas.getGraphicsContext2D(); dgCanvasContainer.getChildren().add(dgCanvas); }
public CreditView() { this.setUpTop(); this.setUpCreditDescription(); FlowPane botContainer = new FlowPane(); botContainer.setOrientation(Orientation.HORIZONTAL); botContainer.setAlignment(Pos.CENTER_RIGHT); botContainer.setPadding(new Insets(5, 5, 5, 5)); Button getBtn = new Button("Оформить заявку"); botContainer.getChildren().add(getBtn); this.setBottom(botContainer); this.getStyleClass().add("credit-view"); }
/** @param fp */ private void makeDialog(FlowPane fp) { Separator sp = new Separator(); // LOGO logoChildBP.setCenter(logo); // LBL TXT lblText = new Text(LBLTXT); Font mFont = Font.font("Dialog", FontPosture.ITALIC, 0xf); lblText.setFont(mFont); lblText.setFill(Color.BLUEVIOLET); lblText.setWrappingWidth(0x12c); labelChildBP.setCenter(lblText); // ---------------------------------------------------------------------- addItems(fp); // ---------------------------------------------------------------------- this.addButt = new Button("ADD NEW"); this.addButt.setDefaultButton(true); this.addButt.setAlignment(Pos.TOP_RIGHT); this.addButt.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { addNewItemsDialog(); primaryStage.close(); } }); fp.getChildren().add(addButt); }
/** * shows the options to edit the selected shape * * @param selectedShape the shape currently selected */ public void shapeSelected(ReactiveShape selectedShape) { shape = selectedShape; switch (shape.getShapeType()) { case ReactiveShape.RECTANGLE: type.setValue(TYPE_RECTANGLE); break; case ReactiveShape.CIRCLE: type.setValue(TYPE_CIRCLE); break; case ReactiveShape.TRIANGLE: type.setValue(TYPE_TRIANGLE); break; } backgroundPane.setVisible(false); shapePane.setVisible(true); color.setValue(shape.getColor()); filled.setSelected(shape.isFilled()); borderThickness.setText("" + shape.getBorderThickness()); borderColor.setValue(shape.getBorderColor()); width.setText("" + (int) shape.getWidth()); height.setText("" + (int) shape.getHeight()); }
// wyœwietla wszystkie albumy private void drawAlbums() { for (int i = 0; i < albumList.size(); i++) { VBox vBox = new VBox(5); // ok³adka albumu Song tempSong = new Song(albumList.get(i).albumSongList.get(0)); ImageView albumCover = new ImageView(tempSong.getAlbumCover()); albumCover.setFitWidth(130); albumCover.setPreserveRatio(true); albumCover.setSmooth(true); albumCover.imageProperty().bind(tempSong.albumCoverProperty()); // tytu³ albumu Text albumTitle = new Text(albumList.get(i).getAlbumTitle()); albumTitle.getStyleClass().add("text"); vBox.getChildren().addAll(albumCover, albumTitle); vBox.setAlignment(Pos.CENTER); // dodaje do ka¿dego albumu listener którym otwiera listê z piosenkami vBox.setOnMouseClicked( e -> { Text tempText = (Text) vBox.getChildren().get(1); for (int j = 0; j < albumList.size(); j++) { if (albumList.get(j).getAlbumTitle().equals(tempText.getText())) { showCurrentAlbum(albumList.get(j)); break; } } }); flowPane.getChildren().add(vBox); } }
// wyœwietla wszystkie playlisty private void drawPlaylists() { for (int i = 0; i < playlistList.size(); i++) { VBox vBox = new VBox(5); ImageView playlistCover = new ImageView(new Image(new File("temp_cover.png").toURI().toString())); playlistCover.setFitWidth(130); playlistCover.setPreserveRatio(true); playlistCover.setSmooth(true); int ext = playlistList.get(i).getName().lastIndexOf('.'); Text playlistTitle = new Text(playlistList.get(i).getName().substring(0, ext)); playlistTitle.getStyleClass().add("text"); vBox.getChildren().addAll(playlistCover, playlistTitle); vBox.setAlignment(Pos.CENTER); vBox.setOnMouseClicked( e -> { Text tempText = (Text) vBox.getChildren().get(1); showCurrentPlaylist(new File("Playlists/" + tempText.getText() + ".fpl")); }); flowPane.getChildren().add(vBox); } }
@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(); }
private void populateAssignedUser(List<PickerAssignee> users, FlowPane assignedUserPane) { assignedUserPane.getChildren().clear(); updateExistingAssignee(users, assignedUserPane); addSeparator(assignedUserPane); updateNewlyAddedAssignee(users, assignedUserPane); }
private void updateChildren(boolean useButtons) { hboxLayout.getChildren().clear(); hboxLayout.getChildren().addAll(createChildren(useButtons)); vboxLayout.getChildren().clear(); vboxLayout.getChildren().addAll(createChildren(useButtons)); flowLayout.getChildren().clear(); flowLayout.getChildren().addAll(createChildren(useButtons)); List<Node> contents1 = createChildren(useButtons); gridLayout.getChildren().clear(); gridLayout.add(contents1.get(0), 0, 0); gridLayout.add(contents1.get(1), 1, 0); gridLayout.add(contents1.get(2), 0, 1, 2, 1); List<Node> contents = createChildren(useButtons); borderLayout.getChildren().clear(); borderLayout.setLeft(contents.get(0)); borderLayout.setTop(contents.get(1)); borderLayout.setRight(contents.get(2)); borderLayout.setBottom(contents.get(3)); borderLayout.setCenter(contents.get(4)); stackLayout.getChildren().clear(); stackLayout.getChildren().addAll(createChildren(useButtons)); tileLayout.getChildren().clear(); tileLayout.getChildren().addAll(createChildren(useButtons)); }
@FXML protected void playlistsButton() { addAlbumButton.disableProperty().set(true); addPlaylistButton.disableProperty().set(false); flowPane.getChildren().clear(); drawPlaylists(); }
/** @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); } }
/** @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); } }
public void buildPlayerLabels(int noLabels) { remainingWallLabels = new Label[noLabels]; for (int i = 0; i < noLabels; i++) { remainingWallLabels[i] = new Label(); remainingWallLabels[i].setId("playerLabels"); remainingWallLabels[i].setWrapText(true); remainingWallLabels[i].setAlignment(Pos.CENTER); infoPane.getChildren().addAll(remainingWallLabels[i]); } }
// pokazuje wybran¹ playliste private void showCurrentPlaylist(File playlistFile) { flowPane.getChildren().clear(); // ok³adka playlisty ImageView playlistCover = new ImageView(new Image(new File("temp_cover.png").toURI().toString())); playlistCover.setFitWidth(200); playlistCover.setPreserveRatio(true); playlistCover.setSmooth(true); // nazwa playlisty int ext = playlistFile.getName().lastIndexOf('.'); Text playlistTitle = new Text(playlistFile.getName().substring(0, ext)); playlistTitle.setFont(new Font("Segoe UI Light", 20)); playlistTitle.setFill(Paint.valueOf("WHITE")); VBox playlistData = new VBox(playlistCover, playlistTitle); flowPane.getChildren().add(playlistData); loadSongs(Playlist.loadPlaylist(playlistFile)); }
// pokazuje piosenki wybranego albumu private void showCurrentAlbum(Album album) { flowPane.getChildren().clear(); Song tempSong = album.getSongs().get(0); // ok³adka albumu ImageView albumCover = new ImageView(tempSong.getAlbumCover()); albumCover.imageProperty().bind(tempSong.albumCoverProperty()); albumCover.setFitWidth(200); albumCover.setPreserveRatio(true); // tytu³ albumu Text albumTitle = new Text(tempSong.getAlbum()); albumTitle.textProperty().bind(tempSong.albumProperty()); albumTitle.setFont(new Font("Segoe UI Light", 20)); albumTitle.setFill(Paint.valueOf("WHITE")); // VBox zawieraj¹cy ok³adkê i tytu³ VBox albumData = new VBox(albumCover, albumTitle); flowPane.getChildren().addAll(albumData); loadSongs(album.getSongs()); }
private void addStories( KanbanBoardState current, Function<KanbanBoardState, List<? extends StoryInLane>> storiesOfType, FlowPane column) { column.getChildren().clear(); List<? extends StoryInLane> stories = storiesOfType.apply(current); stories .stream() .map(StoryInLane::story) .limit(MAX_STORIES_DISPLAYED) .forEach( story -> { column.getChildren().add(story(String.format("#%d", story.storyNumber()))); }); if (stories.size() > MAX_STORIES_DISPLAYED) { column .getChildren() .add(new Text(String.format("and %d more...", stories.size() - MAX_STORIES_DISPLAYED))); } }
/** Create a FlowPane to display the content and time with different css styles. */ private Node createTextFlow(String... msg) { FlowPane flow = new FlowPane(); boolean isTime = false; for (String s : msg) { if (TIME_PLACEHOLDER.equals(s)) { isTime = true; continue; } Text text = new Text(s); if (isTime) { text.getStyleClass().addAll(TIME_CLASS_CSS); isTime = false; } else { text.getStyleClass().add(PLAIN_CLASS_CSS); } flow.getChildren().add(text); } return flow; }
private void updateNewlyAddedAssignee(List<PickerAssignee> users, FlowPane assignedUserPane) { users .stream() .filter(PickerAssignee::isSelected) .forEach( user -> assignedUserPane .getChildren() .add( setMouseClickForNode( user.getNewlyAssignedAssigneeNode(), user.getLoginName()))); }
@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); }
@Override public void start(Stage stage) throws Exception { FlowPane root = new FlowPane(); // smiley face is just the first one google showed me - not mine! ObservableList<Buddy> buddies = FXCollections.observableArrayList( new Buddy("http://www.pavendors.com/images/smileyface.gif", "Don Haig", true), new Buddy("http://www.pavendors.com/images/smileyface.gif", "David Sloan", false)); ListView<Buddy> buddiesList = new ListView<Buddy>(buddies); buddiesList.setCellFactory( new Callback<ListView<Buddy>, ListCell<Buddy>>() { public ListCell<Buddy> call(ListView<Buddy> buddyListView) { final BuddyCell buddyCell = new BuddyCell(); ListCell<Buddy> cell = new ListCell<Buddy>() { protected void updateItem(Buddy buddy, boolean empty) { super.updateItem(buddy, empty); buddyCell.setVisible(!empty); buddyCell.setBuddy(buddy); } }; cell.setGraphic(buddyCell); return cell; } }); TitledPane buddiesArea = new TitledPane("Buddies", buddiesList); root.getChildren().addAll(buddiesArea); Scene scene = new Scene(root, 800, 600); scene.getStylesheets().add("styles.css"); stage.setScene(scene); stage.show(); }
private void createCharacter(Character newCharacter) { Button btn = createCharacterBtn( getRandomAvatarPath(), Constants.AVATAR_IMAGE_WIDTH, Constants.AVATAR_IMAGE_HEIGHT); btn.setText( String.format( "%s\nLevel: %s\nClass: %s \nRace: %s", newCharacter.getCharacterName(), newCharacter.getCharacterLevel(), newCharacter.getCharacterClass(), newCharacter.getCharacterRace())); characterList.getChildren().add(0, btn); }
// wyœwietla wszystkie piosenki w postaci listy private void drawAllFiles() { ObservableList<Song> allSongs = FXCollections.observableArrayList(); for (File file : fileList) { allSongs.add(new Song(file.getAbsolutePath())); } // obrazek ImageView allFilesCover = new ImageView(new Image(new File("allfiles_cover.jpg").toURI().toString())); allFilesCover.setFitWidth(700); allFilesCover.setFitHeight(200); allFilesCover.setSmooth(true); flowPane.getChildren().add(allFilesCover); loadSongs(allSongs); }
@FXML protected void addPlaylistButtom() { // wybieranie playlisty FileChooser fc = new FileChooser(); fc.getExtensionFilters().add(new ExtensionFilter("Playlist", "*.fpl")); File playlistFile = fc.showOpenDialog(root.getScene().getWindow()); // kopiowanie playlisty i dodanie jej do biblioteki File destinationDirectory = new File("Playlists/" + playlistFile.getName()); if (playlistFile.exists()) { try { FileUtils.copyFile(playlistFile, destinationDirectory); playlistList.add(playlistFile); flowPane.getChildren().clear(); drawPlaylists(); } catch (IOException e) { e.printStackTrace(); } } SystemTrayIcon.trayMessage("Succes", "Added new playlist"); }
@FXML protected void addAlbumButton() { // wybieranie folderu z albumem DirectoryChooser directoryChooser = new DirectoryChooser(); directoryChooser.setTitle("Choose album folder"); File selectedDirectory = directoryChooser.showDialog(root.getScene().getWindow()); // kopiowanie albumu do folderu biblioteki File destinationDirectory = new File("C:/Users/Public/Music/" + selectedDirectory.getName()); try { FileUtils.copyDirectory(selectedDirectory, destinationDirectory); flowPane.getChildren().clear(); clearData(); loadAlbums(); drawAlbums(); } catch (IOException e) { e.printStackTrace(); } SystemTrayIcon.trayMessage("Succes", "Added new album"); }
@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(); }
@Override public void start(Stage stage) throws Exception { this.mainBorderPane = new BorderPane(); FlowPane toolbar = new FlowPane(); Button btnClear = new Button("Clear"); btnClear.setOnAction( event -> { root.getChildren().clear(); }); Button btnLoadFtof = new Button("FTOF"); btnLoadFtof.setOnAction( event -> { loadDetector("FTOF"); }); toolbar.getChildren().add(btnClear); toolbar.getChildren().add(btnLoadFtof); SplitPane splitPane = new SplitPane(); StackPane treePane = new StackPane(); root = new Group(); BorderPane pane = new BorderPane(); treeView = new TreeView<String>(); treePane.getChildren().add(treeView); this.content = new ContentModel(800, 800, 200); this.content.setContent(root); content.getSubScene().heightProperty().bind(pane.heightProperty()); content.getSubScene().widthProperty().bind(pane.widthProperty()); pane.setCenter(content.getSubScene()); mainBorderPane.setTop(toolbar); splitPane.getItems().addAll(treePane, pane); splitPane.setDividerPositions(0.2); // this.addDetector("FTOF"); // this.test(); this.testFTOF(); // this.testDC(); // this.testBST(); // final Scene scene = new Scene(pane, 880, 880, true); this.mainBorderPane.setCenter(splitPane); HBox statusPane = new HBox(); ColorPicker colorPicker = new ColorPicker(); colorPicker.setOnAction( new EventHandler() { @Override public void handle(Event event) { content.setBackgroundColor(colorPicker.getValue()); } }); statusPane.getChildren().add(colorPicker); this.mainBorderPane.setBottom(statusPane); final Scene scene = new Scene(mainBorderPane, 1280, 880, true); scene.setFill(Color.ALICEBLUE); stage.setTitle("CLAS12 Geometry Viewer - JavaFX3D"); stage.setScene(scene); stage.show(); }
private void updateExistingAssignee(List<PickerAssignee> users, FlowPane assignedUserPane) { Optional<PickerAssignee> existingAssignee = PickerAssignee.getExistingAssignee(users); Node existingAssigneeNode = createExistingAssigneeNode(existingAssignee); assignedUserPane.getChildren().add(existingAssigneeNode); }