Java Code Examples for javafx.scene.layout.Pane#setMaxSize()
The following examples show how to use
javafx.scene.layout.Pane#setMaxSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PieSkin.java From WorkbenchFX with Apache License 2.0 | 6 votes |
@Override public void initializeParts() { double center = ARTBOARD_HEIGHT * 0.5; border = new Circle(center, center, center); border.getStyleClass().add("border"); pieSlice = new Arc(center, center, center - 1, center - 1, 90, 0); pieSlice.getStyleClass().add("pieSlice"); pieSlice.setType(ArcType.ROUND); valueField = new TextField(); valueField.relocate(ARTBOARD_HEIGHT + 5, 2); valueField.setPrefWidth(ARTBOARD_WIDTH - ARTBOARD_HEIGHT - 5); valueField.getStyleClass().add("valueField"); // always needed drawingPane = new Pane(); drawingPane.setMaxSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT); drawingPane.setMinSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT); drawingPane.setPrefSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT); }
Example 2
Source File: ClickableBitcoinAddress.java From green_android with GNU General Public License v3.0 | 6 votes |
@FXML protected void showQRCode(MouseEvent event) { // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling // lazy tonight. final byte[] imageBytes = QRCode .from(uri()) .withSize(320, 240) .to(ImageType.PNG) .stream() .toByteArray(); Image qrImage = new Image(new ByteArrayInputStream(imageBytes)); ImageView view = new ImageView(qrImage); view.setEffect(new DropShadow()); // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird. // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being // non-centered on the screen. Finally fade/blur it in. Pane pane = new Pane(view); pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight()); final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this); view.setOnMouseClicked(event1 -> overlay.done()); }
Example 3
Source File: ClickableBitcoinAddress.java From GreenBits with GNU General Public License v3.0 | 6 votes |
@FXML protected void showQRCode(MouseEvent event) { // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling // lazy tonight. final byte[] imageBytes = QRCode .from(uri()) .withSize(320, 240) .to(ImageType.PNG) .stream() .toByteArray(); Image qrImage = new Image(new ByteArrayInputStream(imageBytes)); ImageView view = new ImageView(qrImage); view.setEffect(new DropShadow()); // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird. // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being // non-centered on the screen. Finally fade/blur it in. Pane pane = new Pane(view); pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight()); final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this); view.setOnMouseClicked(event1 -> overlay.done()); }
Example 4
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Create the desktop swing node */ private void createDesktopNode() { // Create group to hold swingNode which in turns holds the Swing desktop desktopNode = new SwingNode(); // desktopNode.setStyle("-fx-background-color: black; "); desktop = new MainDesktopPane(this); desktopNode.setStyle("-fx-background-color: transparent; -fx-border-color: black; "); desktopPane = new Pane(desktopNode); desktopPane.setMaxSize(screen_width - 25, screen_height); // TAB_PANEL_HEIGHT // Add main pane WebPanel mainPane = new WebPanel(new BorderLayout()); mainPane.setSize(screen_width - 25 , screen_height - 15); mainPane.add(desktop, BorderLayout.CENTER); // desktopNode.setContent(mainPane); SwingUtilities.invokeLater(() -> desktopNode.setContent(mainPane)); // desktopNode.requestFocus(); }
Example 5
Source File: ClickableBitcoinAddress.java From devcoretalk with GNU General Public License v2.0 | 6 votes |
@FXML protected void showQRCode(MouseEvent event) { // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling // lazy tonight. final byte[] imageBytes = QRCode .from(uri()) .withSize(320, 240) .to(ImageType.PNG) .stream() .toByteArray(); Image qrImage = new Image(new ByteArrayInputStream(imageBytes)); ImageView view = new ImageView(qrImage); view.setEffect(new DropShadow()); // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird. // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being // non-centered on the screen. Finally fade/blur it in. Pane pane = new Pane(view); pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight()); final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this); view.setOnMouseClicked(event1 -> overlay.done()); }
Example 6
Source File: MainDialog.java From bandit with Apache License 2.0 | 6 votes |
@Override public void initialize(URL url, ResourceBundle resourceBundle) { armsLabel.setText(Joiner.on(" - ").join(Lists.transform(arms, Arm::getExpectedValue))); for (int i = 0; i < algorithms.size(); i++) { BanditAlgorithm algorithm = algorithms.get(i); Pane colorPanel = new Pane(); colorPanel.setMinSize(10, 10); colorPanel.setMaxSize(10, 10); Color color = Colors.getColor(i); Rectangle colorRectangle = new Rectangle(10, 10, rgb(color.getRed(), color.getGreen(), color.getBlue())); algorithmsPane.add(colorRectangle, 0, i); Label label = new Label(algorithm.toString()); algorithmsPane.add(label, 1, i); } }
Example 7
Source File: FridayFunSkin.java From WorkbenchFX with Apache License 2.0 | 5 votes |
@Override public void initializeParts() { double center = ARTBOARD_SIZE * 0.5; int width = 15; double radius = center - width; backgroundCircle = new Circle(center, center, radius); backgroundCircle.getStyleClass().add("backgroundCircle"); bar = new Arc(center, center, radius, radius, 90.0, 0.0); bar.getStyleClass().add("bar"); bar.setType(ArcType.OPEN); thumb = new Circle(center, center + center - width, 13); thumb.getStyleClass().add("thumb"); valueDisplay = createCenteredText(center, center, "valueDisplay"); ticks = createTicks(center, center, 60, 360.0, 6, 33, 0, "tick"); tickLabels = new ArrayList<>(); int labelCount = 8; for (int i = 0; i < labelCount; i++) { double r = 95; double nextAngle = i * 360.0 / labelCount; Point2D p = pointOnCircle(center, center, r, nextAngle); Text tickLabel = createCenteredText(p.getX(), p.getY(), "tickLabel"); tickLabels.add(tickLabel); } updateTickLabels(); drawingPane = new Pane(); drawingPane.getStyleClass().add("numberRange"); drawingPane.setMaxSize(ARTBOARD_SIZE, ARTBOARD_SIZE); drawingPane.setMinSize(ARTBOARD_SIZE, ARTBOARD_SIZE); drawingPane.setPrefSize(ARTBOARD_SIZE, ARTBOARD_SIZE); }
Example 8
Source File: SlimSkin.java From WorkbenchFX with Apache License 2.0 | 5 votes |
private void initializeParts() { double cx = ARTBOARD_WIDTH * 0.5; separator = new Line(25, 15, 225, 15); separator.getStyleClass().add("separator"); separator.setStrokeLineCap(StrokeLineCap.ROUND); titleLabel = createCenteredText(cx, 19, "title"); titleLabel.setTextOrigin(VPos.TOP); valueLabel = createCenteredText(cx, 150, "value"); unitLabel = createCenteredText(cx, 188, "unit"); unitLabel.setTextOrigin(VPos.TOP); barBackground = new Circle(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, RADIUS); barBackground.getStyleClass().add("barBackground"); bar = new Arc(CIRCLE_CENTER_X, CIRCLE_CENTER_Y, RADIUS, RADIUS, START_ANGLE, 0); bar.getStyleClass().add("bar"); bar.setType(ArcType.OPEN); thumb = new Circle(7); thumb.getStyleClass().add("thumb"); // always needed drawingPane = new Pane(); drawingPane.setMaxSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT); drawingPane.setMinSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT); drawingPane.setPrefSize(ARTBOARD_WIDTH, ARTBOARD_HEIGHT); }
Example 9
Source File: SelectSongsDialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Set the songs to be shown in the dialog. * <p/> * @param songs the list of songs to be shown. * @param checkList a list corresponding to the song list - each position is * true if the checkbox should be selected, false otherwise. * @param defaultVal the default value to use for the checkbox if checkList * is null or smaller than the songs list. */ public void setSongs(final List<SongDisplayable> songs, final Map<SongDisplayable, Boolean> checkList, final boolean defaultVal) { this.songs = songs; gridPane.getChildren().clear(); checkBoxes.clear(); gridPane.getColumnConstraints().add(new ColumnConstraints(20)); ColumnConstraints titleConstraints = new ColumnConstraints(); titleConstraints.setHgrow(Priority.ALWAYS); titleConstraints.setPercentWidth(50); gridPane.getColumnConstraints().add(titleConstraints); ColumnConstraints authorConstraints = new ColumnConstraints(); authorConstraints.setHgrow(Priority.ALWAYS); authorConstraints.setPercentWidth(45); gridPane.getColumnConstraints().add(authorConstraints); Label titleHeader = new Label(LabelGrabber.INSTANCE.getLabel("title.label")); titleHeader.setAlignment(Pos.CENTER); Label authorHeader = new Label(LabelGrabber.INSTANCE.getLabel("author.label")); authorHeader.setAlignment(Pos.CENTER); gridPane.add(titleHeader, 1, 0); gridPane.add(authorHeader, 2, 0); for(int i = 0; i < songs.size(); i++) { SongDisplayable song = songs.get(i); CheckBox checkBox = new CheckBox(); checkBox.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) { checkEnableButton(); } }); if(checkList != null) { final Boolean result = checkList.get(song); if(result!=null) { checkBox.setSelected(!result); } } checkBoxes.add(checkBox); gridPane.add(checkBox, 0, i + 1); gridPane.add(new Label(song.getTitle()), 1, i + 1); gridPane.add(new Label(song.getAuthor()), 2, i + 1); } for(int i = 0; i < 2; i++) { Node n = gridPane.getChildren().get(i); if(n instanceof Control) { Control control = (Control) n; control.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); control.setStyle("-fx-alignment: center;-fx-font-weight: bold;"); } if(n instanceof Pane) { Pane pane = (Pane) n; pane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); pane.setStyle("-fx-alignment: center;-fx-font-weight: bold;"); } } gridScroll.setVvalue(0); checkEnableButton(); }