Java Code Examples for javafx.scene.layout.TilePane#setAlignment()

The following examples show how to use javafx.scene.layout.TilePane#setAlignment() . 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: 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 3
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 4
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 5
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);
}
 
Example 6
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");
																													// "\"
}