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

The following examples show how to use javafx.scene.layout.TilePane#setPrefColumns() . 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: 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 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: 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: 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 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: 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 8
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 9
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");
																													// "\"
}