Java Code Examples for javafx.scene.layout.TilePane

The following examples show how to use javafx.scene.layout.TilePane. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: marathonv5   Source File: TilePaneSample.java    License: Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    TilePane iconTilePane = new TilePane();
    iconTilePane.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    iconTilePane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] rec = new Rectangle[9];
    for (int i = 0; i < rec.length; i++) {
        rec[i] = new Rectangle(14, 14, Color.web("#349b00"));
        TilePane.setMargin(rec[i], new Insets(2, 2, 2, 2));
    }
    iconTilePane.getChildren().addAll(rec);
    sp.getChildren().addAll(rectangle, iconTilePane);
    return new Group(sp);
}
 
Example 2
Source Project: marathonv5   Source File: TilePaneSample.java    License: Apache License 2.0 6 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    TilePane iconTilePane = new TilePane();
    iconTilePane.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    iconTilePane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] rec = new Rectangle[9];
    for (int i = 0; i < rec.length; i++) {
        rec[i] = new Rectangle(14, 14, Color.web("#349b00"));
        TilePane.setMargin(rec[i], new Insets(2, 2, 2, 2));
    }
    iconTilePane.getChildren().addAll(rec);
    sp.getChildren().addAll(rectangle, iconTilePane);
    return new Group(sp);
}
 
Example 3
Source Project: phoebus   Source File: RGBFactoryDemo.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void start(final Stage stage)
{
    final TilePane layout = new TilePane();
    layout.setPrefColumns(3);
    final RGBFactory colors = new RGBFactory();
    int index = 0;
    for (int row=0; row<20; ++row)
        for (int col=0; col<3; ++col)
        {
            final Color color = colors.next();
            final Label text = new Label("COLOR " + (++index) + ": " + color);
            text.setTextFill(color);
            layout.getChildren().add(text);
        }

    final Scene scene = new Scene(layout);
    stage.setScene(scene);
    stage.show();
}
 
Example 4
Source Project: JavaFX   Source File: Minimal.java    License: MIT License 6 votes vote down vote up
private Node createLoadPane() {
	loadPane = new TilePane(5, 5);
	loadPane.setPrefColumns(3);
	loadPane.setPadding(new Insets(5));
	for (int i = 0; i < 9; i++) {
		StackPane waitingPane = new StackPane();
		Rectangle background = new Rectangle((380) / 3, (380) / 3,
				Color.WHITE);
		indicators[i] = new ProgressIndicator();
		indicators[i].setPrefSize(50, 50);
		indicators[i].setMaxSize(50, 50);
		indicators[i].setTranslateY(-25);
		indicators[i].setTranslateX(-10);
		loading[i] = new Label();
		loading[i].setTranslateY(25);
		waitingPane.getChildren().addAll(background, indicators[i],
				loading[i]);
		loadPane.getChildren().add(waitingPane);
	}

	return loadPane;
}
 
Example 5
Source Project: oim-fx   Source File: OnlyPopupOverFrame.java    License: MIT License 5 votes vote down vote up
public Parent createContent() {
	Image ICON_48 = new Image(OnlyPopupOverFrame.class.getResourceAsStream("/resources/common/images/logo/logo_1.png"));
	TilePane tilePane = new TilePane();
	tilePane.setPrefColumns(2); // preferred columns
	tilePane.setAlignment(Pos.CENTER);
	Button[] buttons = new Button[6];

	for (int j = 0; j < buttons.length; j++) {
		buttons[j] = new Button("button" + (j + 1), new ImageView(ICON_48));
		tilePane.getChildren().add(buttons[j]);
	}

	return tilePane;
}
 
Example 6
Source Project: oim-fx   Source File: WebViewFrame.java    License: MIT License 5 votes vote down vote up
public Parent createContent() {
	Image ICON_48 = new Image(WebViewFrame.class.getResourceAsStream("/resources/common/images/logo/logo_1.png"));
	TilePane tilePane = new TilePane();
	tilePane.setPrefColumns(2); // preferred columns
	tilePane.setAlignment(Pos.CENTER);
	Button[] buttons = new Button[6];

	for (int j = 0; j < buttons.length; j++) {
		buttons[j] = new Button("button" + (j + 1), new ImageView(ICON_48));
		tilePane.getChildren().add(buttons[j]);
	}

	return tilePane;
}
 
Example 7
Source Project: marathonv5   Source File: CursorSample.java    License: Apache License 2.0 5 votes vote down vote up
public CursorSample() {
    TilePane tilePaneRoot = new TilePane(5, 5);
    tilePaneRoot.setHgap(2);
    tilePaneRoot.setVgap(2);
    tilePaneRoot.getChildren().addAll(
        createBox(Cursor.DEFAULT),
        createBox(Cursor.CROSSHAIR),
        createBox(Cursor.TEXT),
        createBox(Cursor.WAIT),
        createBox(Cursor.SW_RESIZE),
        createBox(Cursor.SE_RESIZE),
        createBox(Cursor.NW_RESIZE),
        createBox(Cursor.NE_RESIZE),
        createBox(Cursor.N_RESIZE),
        createBox(Cursor.S_RESIZE),
        createBox(Cursor.W_RESIZE),
        createBox(Cursor.E_RESIZE),
        createBox(Cursor.OPEN_HAND),
        createBox(Cursor.CLOSED_HAND),
        createBox(Cursor.HAND),
        createBox(Cursor.DISAPPEAR),
        createBox(Cursor.MOVE),
        createBox(Cursor.H_RESIZE),
        createBox(Cursor.V_RESIZE),
        createBox(Cursor.NONE)
    );
    getChildren().add(tilePaneRoot);
}
 
Example 8
Source Project: marathonv5   Source File: TilePaneSample.java    License: Apache License 2.0 5 votes vote down vote up
public TilePaneSample() {

     TilePane tilePane = new TilePane();
     tilePane.setPrefColumns(3); //preferred columns

     Button[] buttons = new Button[18];
     for (int j = 0; j < buttons.length; j++) {
         buttons[j] = new Button("button" + (j + 1), new ImageView(ICON_48));
         tilePane.getChildren().add(buttons[j]);
     }
     getChildren().add(tilePane);
 }
 
Example 9
Source Project: marathonv5   Source File: CursorSample.java    License: Apache License 2.0 5 votes vote down vote up
public CursorSample() {
    TilePane tilePaneRoot = new TilePane(5, 5);
    tilePaneRoot.setHgap(2);
    tilePaneRoot.setVgap(2);
    tilePaneRoot.getChildren().addAll(
        createBox(Cursor.DEFAULT),
        createBox(Cursor.CROSSHAIR),
        createBox(Cursor.TEXT),
        createBox(Cursor.WAIT),
        createBox(Cursor.SW_RESIZE),
        createBox(Cursor.SE_RESIZE),
        createBox(Cursor.NW_RESIZE),
        createBox(Cursor.NE_RESIZE),
        createBox(Cursor.N_RESIZE),
        createBox(Cursor.S_RESIZE),
        createBox(Cursor.W_RESIZE),
        createBox(Cursor.E_RESIZE),
        createBox(Cursor.OPEN_HAND),
        createBox(Cursor.CLOSED_HAND),
        createBox(Cursor.HAND),
        createBox(Cursor.DISAPPEAR),
        createBox(Cursor.MOVE),
        createBox(Cursor.H_RESIZE),
        createBox(Cursor.V_RESIZE),
        createBox(Cursor.NONE)
    );
    getChildren().add(tilePaneRoot);
}
 
Example 10
Source Project: marathonv5   Source File: TilePaneSample.java    License: Apache License 2.0 5 votes vote down vote up
public TilePaneSample() {

     TilePane tilePane = new TilePane();
     tilePane.setPrefColumns(3); //preferred columns

     Button[] buttons = new Button[18];
     for (int j = 0; j < buttons.length; j++) {
         buttons[j] = new Button("button" + (j + 1), new ImageView(ICON_48));
         tilePane.getChildren().add(buttons[j]);
     }
     getChildren().add(tilePane);
 }
 
Example 11
@Override
public TilePane createJFXNode() throws Exception
{
    final TilePane pane = new TilePane(GAP, GAP, createButton(null));
    pane.setTileAlignment(Pos.BASELINE_LEFT);
    return pane;
}
 
Example 12
Source Project: phoebus   Source File: RadioRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public TilePane createJFXNode() throws Exception
{
    final TilePane pane = new TilePane(5.0, 5.0, createRadioButton(null));
    pane.setTileAlignment(Pos.BASELINE_LEFT);
    return pane;
}
 
Example 13
Source Project: phoebus   Source File: Palette.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/** Create a TilePane for each WidgetCategory
 *  @param parent Parent Pane
 *  @return Map of panes for each category
 */
private Map<WidgetCategory, Pane> createWidgetCategoryPanes(final Pane parent)
{
    final Map<WidgetCategory, Pane> palette_groups = new HashMap<>();
    final Set<String> deprecated = Preferences.hidden_widget_types;
    for (final WidgetCategory category : WidgetCategory.values())
    {
        if (!WidgetFactory.getInstance()
        .getWidgetDescriptions()
        .stream()
        .filter(desc -> !deprecated.contains(desc.getType()))
        .filter(desc -> desc.getCategory() == category)
        .findFirst().isPresent())
            continue;
        final TilePane palette_group = new TilePane();
        palette_group.getStyleClass().add("palette_group");
        palette_group.setPrefColumns(1);
        palette_group.setMaxWidth(Double.MAX_VALUE);
        palette_groups.put(category, palette_group);
        palette_group.setHgap(2);
        palette_group.setVgap(2);
        final TitledPane pane = new TitledPane(category.getDescription(), palette_group);
        pane.getStyleClass().add("palette_category");
        parent.getChildren().add(pane);
    }
    return palette_groups;
}
 
Example 14
/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final Text title = new Text(tr("Tools"));
    title.getStyleClass().add("title");

    final TilePane toolsContainer = createToolsContainer();
    toolsContainer.getStyleClass().add("tool-grid");

    final VBox toolsPane = new VBox(title, toolsContainer);
    toolsPane.getStyleClass().addAll("container-details-panel", "container-tools-panel");

    getChildren().setAll(toolsPane);
}
 
Example 15
Source Project: oim-fx   Source File: WritePaneFrame.java    License: MIT License 4 votes vote down vote up
private void init() {
	this.setBackground("Resources/Images/Wallpaper/18.jpg");
	this.setTitle("登录");
	this.setWidth(440);
	this.setHeight(360);
	this.setCenter(rootPane);

	HBox topBox = new HBox();
	topBox.setStyle("-fx-background-color:#2cb1e0");
	topBox.setPrefHeight(30);

	insertImageButton.setFocusTraversable(false);
	fontFamilyComboBox.setFocusTraversable(false);
	button.setFocusTraversable(false);
	fontSizeA.setFocusTraversable(false);
	fontSizeD.setFocusTraversable(false);
	boldButton.setFocusTraversable(false);
	underlineButton.setFocusTraversable(false);
	italicButton.setFocusTraversable(false);
	htmlButton.setFocusTraversable(false);

	TilePane tilePane = new TilePane();
	tilePane.setPrefColumns(3); // preferred columns
	tilePane.setAlignment(Pos.CENTER);

	tilePane.getChildren().add(insertImageButton);
	tilePane.getChildren().add(button);
	tilePane.getChildren().add(colorPicker);
	tilePane.getChildren().add(fontSizeA);
	tilePane.getChildren().add(fontFamilyComboBox);
	tilePane.getChildren().add(fontSizeD);
	tilePane.getChildren().add(boldButton);
	tilePane.getChildren().add(underlineButton);
	tilePane.getChildren().add(italicButton);
	tilePane.getChildren().add(htmlButton);

	box.setStyle("-fx-background-color:rgba(255, 255, 255, 0.2)");
	box.getChildren().add(tilePane);
	box.getChildren().add(writePanel);
	box.getChildren().add(textArea);

	// comboBox.setItems("");
	ObservableList<String> fonts = new ObservableListWrapper<String>(new ArrayList<String>()); // FXCollections.observableArrayList(Font.getFamilies());
	fontFamilyComboBox.setItems(fonts);
	// for (String fontFamily : fonts) {
	// if (DEFAULT_OS_FONT.equals(fontFamily)) {
	// fontFamilyComboBox.setValue(fontFamily);
	// }
	//
	// }

	fonts.add("宋体");
	fonts.add("小篆");
	fonts.add("Microsoft YaHei");
	fonts.add("Helvetica");
	fonts.add("TimesRoman");
	fonts.add("Courier");
	fonts.add("Helvetica");
	fonts.add("TimesRoman");

	rootPane.setTop(topBox);
	rootPane.setCenter(box);
}
 
Example 16
Source Project: oim-fx   Source File: WritePanelFrame.java    License: MIT License 4 votes vote down vote up
private void init() {
	this.setBackground("Resources/Images/Wallpaper/18.jpg");
	this.setTitle("登录");
	this.setWidth(440);
	this.setHeight(360);
	this.setCenter(box);

	box.setStyle("-fx-background-color:rgba(255, 255, 255, 0.2)");


	insertImageButton.setFocusTraversable(false);
	fontFamilyComboBox.setFocusTraversable(false);
	button.setFocusTraversable(false);
	fontSizeA.setFocusTraversable(false);
	fontSizeD.setFocusTraversable(false);
	boldButton.setFocusTraversable(false);
	underlineButton.setFocusTraversable(false);
	italicButton.setFocusTraversable(false);
	htmlButton.setFocusTraversable(false);

	TilePane tilePane = new TilePane();
	tilePane.setPrefColumns(3); // preferred columns
	tilePane.setAlignment(Pos.CENTER);

	
	
	
	tilePane.getChildren().add(insertImageButton);
	tilePane.getChildren().add(button);
	tilePane.getChildren().add(colorPicker);
	tilePane.getChildren().add(fontSizeA);
	tilePane.getChildren().add(fontFamilyComboBox);
	tilePane.getChildren().add(fontSizeD);
	tilePane.getChildren().add(boldButton);
	tilePane.getChildren().add(underlineButton);
	tilePane.getChildren().add(italicButton);
	tilePane.getChildren().add(htmlButton);

	Button gap = new Button("gap");

	box.getChildren().add(gap);
	box.getChildren().add(tilePane);
	box.getChildren().add(writePanel);
	box.getChildren().add(textArea);

	// comboBox.setItems("");
	ObservableList<String> fonts = new ObservableListWrapper<String>(new ArrayList<String>()); // FXCollections.observableArrayList(Font.getFamilies());
	fontFamilyComboBox.setItems(fonts);
	// for (String fontFamily : fonts) {
	// if (DEFAULT_OS_FONT.equals(fontFamily)) {
	// fontFamilyComboBox.setValue(fontFamily);
	// }
	//
	// }

	fonts.add("宋体");
	fonts.add("小篆");
	fonts.add("Microsoft YaHei");
	fonts.add("Helvetica");
	fonts.add("TimesRoman");
	fonts.add("Courier");
	fonts.add("Helvetica");
	fonts.add("TimesRoman");
																													// "\"
}
 
Example 17
/**
 * Creates the container for the tool buttons
 *
 * @return The container with the tool buttons
 */
private TilePane createToolsContainer() {
    final TilePane toolsContainer = new TilePane();

    final Button runExecutable = new Button(tr("Run executable"));
    runExecutable.getStyleClass().addAll("toolButton", "runExecutable");
    runExecutable.setOnMouseClicked(event -> {
        getControl().setLockTools(true);

        final FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(tr("Choose executable..."));

        // open in container directory if it exists
        final File containerDir = new File(getControl().getContainer().getPath());
        if (containerDir.canRead()) {
            fileChooser.setInitialDirectory(containerDir);
        }

        final File file = fileChooser.showOpenDialog(getControl().getScene().getWindow());
        if (file != null) {
            final ContainerDTO container = getControl().getContainer();
            final String engineId = container.getEngine().toLowerCase();

            getControl().getEnginesManager().getEngine(engineId,
                    engine -> {
                        engine.setWorkingContainer(container.getName());
                        engine.run(file.getAbsolutePath(), new String[0], container.getPath(), false, true,
                                new HashMap<>());

                        getControl().setLockTools(false);
                    },
                    exception -> Platform.runLater(() -> {
                        final ErrorDialog errorDialog = ErrorDialog.builder()
                                .withMessage(tr("Error"))
                                .withOwner(getControl().getScene().getWindow())
                                .withException(exception)
                                .build();

                        errorDialog.showAndWait();
                    }));
        } else {
            // unlock if file chooser is closed
            getControl().setLockTools(false);
        }
    });

    toolsContainer.getChildren().add(runExecutable);

    return toolsContainer;
}
 
Example 18
Source Project: game-of-life-java   Source File: JavaFXDisplayDriver.java    License: MIT License 4 votes vote down vote up
public TilePane getPane() {
    return tilePane;
}