List of usage examples for javafx.scene.layout TilePane setHgap
public final void setHgap(double value)
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { stage.setTitle("TitledPane"); Scene scene = new Scene(new Group(), 450, 250); scene.setFill(Color.GHOSTWHITE); TilePane tile = new TilePane(Orientation.VERTICAL); tile.setHgap(8); tile.setPrefColumns(4);//from www. ja v a 2 s . c o m for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("asdf")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
License:asdf
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(Orientation.VERTICAL, 0.5, 0.5); tile.setHgap(8); tile.setPrefColumns(4);//from ww w . ja v a2 s. c o m for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("asdf")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
private TilePane addTilePane() { TilePane tile = new TilePane(); tile.setPadding(new Insets(5, 0, 5, 0)); tile.setVgap(4);/*from ww w . j a v a 2s . c o m*/ tile.setHgap(4); tile.setPrefColumns(2); tile.setStyle("-fx-background-color: DAE6F3;"); ImageView pages[] = new ImageView[8]; for (int i = 0; i < 8; i++) { pages[i] = new ImageView( new Image(Main.class.getResourceAsStream("graphics/chart_" + (i + 1) + ".png"))); tile.getChildren().add(pages[i]); } return tile; }
From source file:photobooth.views.ExplorerPane.java
private void init(String dir, int offset, int limit, int directoryLevel) { this.getChildren().removeAll(this.getChildren()); this.dir = dir; this.offset = offset; this.limit = limit; this.directoryLevel = directoryLevel; try {//from ww w . j a v a 2s .c om addXButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } if (directoryLevel > 0) { try { addUpButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } } addLabel(); TilePane tile = new TilePane(); tile.setHgap(12); tile.setVgap(12); File folder = new File(dir); File[] listOfDirs = folder.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); File[] allFileAndDiresctoies = new File[0]; if (listOfDirs != null) { Arrays.sort(listOfDirs); File[] listOfImages = folder.listFiles(new FileFilter() { @Override public boolean accept(File file) { String ext = FilenameUtils.getExtension(file.getAbsolutePath()); return ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("png"); } }); Arrays.sort(listOfImages); allFileAndDiresctoies = new File[listOfDirs.length + listOfImages.length]; System.arraycopy(listOfDirs, 0, allFileAndDiresctoies, 0, listOfDirs.length); System.arraycopy(listOfImages, 0, allFileAndDiresctoies, listOfDirs.length, listOfImages.length); File[] subArray = new File[limit]; int countToCopy = limit; if (offset + limit > allFileAndDiresctoies.length) { countToCopy -= offset + limit - allFileAndDiresctoies.length; } System.arraycopy(allFileAndDiresctoies, offset, subArray, 0, countToCopy); for (final File file : subArray) { if (file == null) { break; } if (file.isFile()) { tile.getChildren().add(createImageView(file)); } else { Button button = new Button(file.getName()); button.setMaxSize(100, 100); button.setMinSize(100, 100); button.setWrapText(true); button.getStyleClass().add("folderButton"); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(file.getAbsolutePath(), 0, limit, directoryLevel + 1); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); tile.getChildren().add(button); } } } this.getChildren().add(tile); tile.setMinWidth(670); tile.setMaxWidth(670); tile.setLayoutX(65); tile.setLayoutY(70); tile.setMaxHeight(390); if (allFileAndDiresctoies.length > offset + limit) { try { addNextButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } } if (offset > 0) { try { addPrevButton(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } } }