javafx.scene.layout.TilePane Java Examples

The following examples show how to use javafx.scene.layout.TilePane. 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: TilePaneSample.java    From marathonv5 with 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 File: Minimal.java    From JavaFX with 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 #3
Source File: RGBFactoryDemo.java    From phoebus with 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 File: TilePaneSample.java    From marathonv5 with 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 #5
Source File: CursorSample.java    From marathonv5 with 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 #6
Source File: TilePaneSample.java    From marathonv5 with 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 #7
Source File: WebViewFrame.java    From oim-fx with 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 #8
Source File: CursorSample.java    From marathonv5 with 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 #9
Source File: TilePaneSample.java    From marathonv5 with 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 #10
Source File: OnlyPopupOverFrame.java    From oim-fx with 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 #11
Source File: ChoiceButtonRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@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 File: RadioRepresentation.java    From phoebus with 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 File: Palette.java    From phoebus with 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
Source File: ContainerToolsPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@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 File: WritePanelFrame.java    From oim-fx with 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 #16
Source File: ContainerToolsPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * 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 #17
Source File: JavaFXDisplayDriver.java    From game-of-life-java with MIT License 4 votes vote down vote up
public TilePane getPane() {
    return tilePane;
}
 
Example #18
Source File: WritePaneFrame.java    From oim-fx with 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);
}