本文整理汇总了Java中javafx.scene.layout.FlowPane.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java FlowPane.setAlignment方法的具体用法?Java FlowPane.setAlignment怎么用?Java FlowPane.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.FlowPane
的用法示例。
在下文中一共展示了FlowPane.setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupTools
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
/**
* Setup the tools tab.
* @param toolTab
*/
private void setupTools(Tab toolTab) {
FlowPane flow = new FlowPane();
flow.setAlignment(Pos.CENTER);
flow.setHgap(5);
flow.setVgap(5);
for(final EditorDefinition definition : EditorDefinition.values()) {
final Button button = new Button(definition.getName());
button.setMinWidth(150);
button.setMinHeight(50);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if(!editors.containsKey(definition))
addEditor(definition);
}
});
flow.getChildren().add(button);
}
toolTab.setContent(flow);
}
示例2: getCenterPane
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private FlowPane getCenterPane() {
FlowPane timerLabelPane = new FlowPane();
timerLabelPane.getChildren().add(timerLabel);
timerLabelPane.setVgap(10);
timerLabelPane.setAlignment(Pos.CENTER);
FlowPane taskLabelPane = new FlowPane();
taskLabelPane.getChildren().addAll(currentTaskLabel, selectedTaskLabel);
taskLabelPane.setVgap(10);
taskLabelPane.setAlignment(Pos.CENTER);
FlowPane taskPane = new FlowPane();
taskPane.setHgap(10);
taskPane.setVgap(10);
taskPane.setAlignment(Pos.CENTER);
taskPane.getChildren().add(setTaskButton);
taskPane.getChildren().add(taskLabelPane);
FlowPane centerPane = new FlowPane();
centerPane.setOrientation(Orientation.VERTICAL);
centerPane.setVgap(10);
centerPane.setAlignment(Pos.CENTER);
centerPane.getChildren().add(timerLabelPane);
centerPane.getChildren().add(taskPane);
return centerPane;
}
示例3: createIconContent
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
FlowPane fp = new FlowPane();
fp.setAlignment(Pos.CENTER);
Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle[] littleRecs = new Rectangle[4];
Rectangle[] bigRecs = new Rectangle[4];
for (int i = 0; i < 4; i++) {
littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4"));
bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00"));
fp.getChildren().addAll(littleRecs[i], bigRecs[i]);
FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2));
}
sp.getChildren().addAll(rectangle, fp);
return new Group(sp);
}
示例4: buildForm
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private void buildForm(Stage primaryStage) {
textAreaClassifiableText = new TextArea();
textAreaClassifiableText.setWrapText(true);
btnClassify = new Button("Classify");
btnClassify.setOnAction(new ClassifyBtnPressEvent());
lblCharacteristics = new Label("");
root = new FlowPane(Orientation.VERTICAL, 10, 10);
root.setAlignment(Pos.BASELINE_CENTER);
root.getChildren().addAll(textAreaClassifiableText, btnClassify, lblCharacteristics);
primaryStage.setScene(new Scene(root, 500, 300));
primaryStage.show();
}
示例5: show
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
void show() {
textAreaLog = new TextArea();
textAreaLog.setWrapText(true);
textAreaLog.setEditable(false);
textAreaLog.setPrefColumnCount(50);
textAreaLog.setPrefRowCount(30);
root = new FlowPane();
root.setAlignment(Pos.BASELINE_CENTER);
root.getChildren().add(textAreaLog);
Stage stage = new Stage();
stage.setScene(new Scene(root));
stage.show();
}
示例6: getTimerButtonsPane
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private FlowPane getTimerButtonsPane() {
FlowPane timerButtonsPane = new FlowPane();
timerButtonsPane.getChildren().add(resetButton);
timerButtonsPane.getChildren().add(changeStateButton);
timerButtonsPane.setHgap(10);
timerButtonsPane.setPadding(new Insets(0, 0, 25, 0));
timerButtonsPane.setAlignment(Pos.CENTER);
return timerButtonsPane;
}
示例7: getUserButtonsPane
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private FlowPane getUserButtonsPane() {
FlowPane userButtonsPane = new FlowPane();
userButtonsPane.getChildren().add(signInButton);
userButtonsPane.getChildren().add(registerButton);
userButtonsPane.setAlignment(Pos.CENTER);
userButtonsPane.setHgap(10);
userButtonsPane.setPadding(new Insets(25, 25, 25, 25));
return userButtonsPane;
}
示例8: getHyperlinkLine
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private Node getHyperlinkLine() {
FlowPane hyperlinkContainer = new FlowPane();
Hyperlink hyperlink = getHyperlink();
Label description = new Label(BUNDLE.getString("menu.about.getSource"));
hyperlinkContainer.getChildren().addAll(description, hyperlink);
hyperlinkContainer.setAlignment(Pos.CENTER);
return hyperlinkContainer;
}
示例9: buildStartGamePanel
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
/**
* Builds the start game panel.
*
* @return the node
*/
private Node buildStartGamePanel() {
final FlowPane fp = new FlowPane();
this.playButton = ButtonBuilder.create().id("playButton")
.styleClass("play")
.minHeight(130)
.minWidth(180)
// .text("Start Game")
.build();
fp.getChildren().add(this.playButton);
fp.setAlignment(Pos.TOP_CENTER);
return fp;
}
示例10: start
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
Rotate rotate = new Rotate();
JFXButton button = new JFXButton("Rotation");
button.getTransforms().add(rotate);
button.addEventHandler(MouseEvent.MOUSE_CLICKED, e ->{
angle += 10;
rotate.setAngle(angle);
rotate.setPivotX(button.getWidth()/2);
rotate.setPivotY(button.getHeight()/2);
});
FlowPane root = new FlowPane();
root.setAlignment(Pos.CENTER);
root.setPadding(new Insets(25,25,25, angle));
root.getChildren().add(button);
Scene scene = new Scene(root,300,250);
primaryStage.setTitle("Button Animation");
primaryStage.setScene(scene);
primaryStage.show();
}
示例11: start
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
@Override
public void start(Stage palco) throws Exception {
StackPane raiz = new StackPane();
TabPane painelLayouts = new TabPane();
Tab tabGridPane = new Tab("Grid Pane");
GridPane gridPane = new GridPane();
gridPane.add(new Label("0 X 0"), 0, 0);
gridPane.add(new Label("0 X 1"), 0, 1);
gridPane.add(new Label("1 X 0"), 1, 0);
gridPane.add(new Label("1 X 1"), 1, 1);
gridPane.setVgap(20);
gridPane.setHgap(20);
gridPane.setTranslateX(120);
gridPane.setTranslateY(30);
tabGridPane.setContent(gridPane);
Tab tabBorderPane = new Tab("Border Pane");
BorderPane borderPane = new BorderPane();
Label lblTop, lblEsquerda, lblBaixo, lblDireita, lblCentro;
borderPane.setTop(lblTop = new Label("Topo"));
borderPane.setLeft(lblEsquerda = new Label("Esquerda"));
borderPane.setBottom(lblBaixo = new Label("Baixo"));
borderPane.setRight(lblDireita = new Label("Direita"));
borderPane.setCenter(lblCentro = new Label("Centro"));
BorderPane.setAlignment(lblTop, Pos.CENTER);
BorderPane.setAlignment(lblEsquerda, Pos.CENTER);
BorderPane.setAlignment(lblBaixo, Pos.CENTER);
BorderPane.setAlignment(lblDireita, Pos.CENTER);
BorderPane.setAlignment(lblCentro, Pos.CENTER);
tabBorderPane.setContent(borderPane);
Tab tabFlowPane = new Tab("Flow Pane");
FlowPane flowPane = new FlowPane();
// define a posição dos elementos: centro, centro para a direita, centro
// para esquerda, topo para esquerda, etc. Tente outros valores para se
// testar!
flowPane.setAlignment(Pos.CENTER_RIGHT);
for (int i = 0; i < 10; i++) {
flowPane.getChildren().add(new Label("Label " + i));
}
tabFlowPane.setContent(flowPane);
painelLayouts.getTabs().addAll(tabGridPane, tabBorderPane, tabFlowPane);
raiz.getChildren().add(painelLayouts);
Scene cena = new Scene(raiz, 350, 150);
palco.setTitle("Gerenciadores de Layout II");
palco.setScene(cena);
palco.show();
}
示例12: getFileExplorerViewCenter
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
private ScrollPane getFileExplorerViewCenter(String pathName, String[] files) {
pathName = pathName.replace("\\", "/");
Button directoryUp = new Button("Up a directory");
directoryUp.setOnAction(e -> {
try {
client.clientCommunicate("DIRECTORYUP");
} catch (IOException e1) {
Logger.log(Level.ERROR, e1.toString());
}
});
Label title = (Label) Styler.styleAdd(new Label("Current Directory:"), "title");
Label pathLabel = (Label) Styler.styleAdd(new Label(pathName), "label-bright");
pathLabel.setWrapText(true);
HBox pathNameBox = Styler.hContainer(5, Styler.vContainer(10, title, pathLabel, directoryUp));
pathNameBox.setPrefHeight(100);
pathNameBox.setPrefWidth(200);
pathNameBox.setPadding(new Insets(5, 5, 5, 5));
FlowPane flow = new FlowPane();
flow.getChildren().add(pathNameBox);
flow.setPadding(new Insets(10, 50, 10, 50));
flow.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
flow.setId("file-pane");
flow.setVgap(10);
flow.setHgap(10);
flow.setAlignment(Pos.CENTER);
HBox icons[] = new HBox[files.length];
int rot = 0;
for (String s : files) {
HBox hBox = new HBox();
hBox.setAlignment(Pos.CENTER);
hBox.setPrefWidth(100);
hBox.setPrefHeight(100);
hBox.setId("file-icon");
hBox.setPadding(new Insets(5, 5, 5, 5));
VBox vBox = new VBox(5);
vBox.setAlignment(Pos.CENTER);
Label label;
label = (Label) Styler.styleAdd(new Label(s), "label-bright");
Tooltip t = new Tooltip(s);
Tooltip.install(hBox, t);
vBox.getChildren().addAll(new ImageView(new Image("/Images/Icons/FileExplorer/" + getExtensionImage(s))), label);
hBox.getChildren().add(vBox);
hBox.setOnMouseClicked(event -> {
if (event.getButton().equals(MouseButton.SECONDARY)) {
if (getExtensionImage(s).contains("folder.png")) {
FileContextMenu.getDirectoryMenu(hBox, s, event, client);
} else {
FileContextMenu.getFileContextMenu(hBox, s, event, client);
}
}
});
icons[rot] = hBox;
flow.getChildren().add(icons[rot]);
rot++;
}
ScrollPane scroll = new ScrollPane();
scroll.setId("scroll-pane");
scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); // Horizontal scroll bar
scroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); // Vertical scroll bar
scroll.setContent(flow);
scroll.viewportBoundsProperty().addListener((ov, oldBounds, bounds) -> {
flow.setPrefWidth(bounds.getWidth());
flow.setPrefHeight(bounds.getHeight());
});
return scroll;
}
示例13: showWindow
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
/**
* Builds and Shows the Window
*
* @param stage
*/
private void showWindow(Stage stage) {
root = new BorderPane();
MenuBar menuBar = buildMenuBar(stage);
FlowPane flow = new FlowPane(Orientation.HORIZONTAL);
flow.setAlignment(Pos.CENTER_RIGHT);
flow.setStyle("-fx-background-color: linear-gradient(to top, -fx-base, derive(-fx-base,30%));");
flow.getChildren().add(new ImageView(new Image("gui/limes.png")));
HBox menuBox = new HBox(0);
menuBox.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(flow, Priority.ALWAYS);
menuBox.getChildren().addAll(menuBar, flow);
toolBox = new ToolBox(this);
graphBuild = new GraphBuildView(toolBox);
HBox runBox = new HBox(0);
runBox.setAlignment(Pos.CENTER_RIGHT);
runButton = new Button("Run");
runButton.setId("runButton");
runButton.setTooltip(new Tooltip("Execute this link specification"));
runButton.setOnAction(e -> {
controller.map();
});
runBox.getChildren().add(runButton);
root.setTop(menuBox);
root.setLeft(toolBox);
root.setRight(graphBuild);
root.setBottom(runBox);
graphBuild.widthProperty().bind(
root.widthProperty().subtract(toolBox.widthProperty()));
graphBuild.heightProperty().bind(toolBox.heightProperty().subtract(runBox.heightProperty()));
toolBox.prefHeightProperty().bind(root.heightProperty().subtract(runBox.heightProperty()));
toolBox.setMinHeight(toolBox.prefHeightProperty().doubleValue());
graphBuild.start();
scene = new Scene(root, 950, 650);
root.prefHeightProperty().bind(scene.heightProperty());
root.prefWidthProperty().bind(scene.widthProperty());
root.minHeightProperty().bind(scene.heightProperty());
root.minWidthProperty().bind(scene.widthProperty());
scene.getStylesheets().add("gui/main.css");
stage.setMinHeight(scene.getHeight());
stage.setMinWidth(scene.getWidth());
stage.setMaximized(true);
stage.setTitle("LIMES");
stage.setScene(scene);
stage.show();
}
示例14: RevenueReportSelectionView
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
@SuppressWarnings("OverridableMethodCallInConstructor")
public RevenueReportSelectionView() {
setAlignment(Pos.CENTER);
setHgap(10);
setVgap(10);
setPadding(new Insets(25, 25, 25, 25));
ChoiceBox<Step> stepChoice = new ChoiceBox<>();
stepChoice.getItems().addAll(Step.values());
step.bind(stepChoice.getSelectionModel().selectedItemProperty());
stepChoice.getSelectionModel().select(Step.MONTH);
addRow(0, new Label("Step:"), stepChoice);
ChoiceBox<String> contractorChoice = new ChoiceBox<>();
contractorChoice.getItems().addAll(Dl.local().lookup(CachedMandators.class).loadContractors()
.all().stream().map(TradeName::name).collect(Collectors.toList()));
contractorChoice.getItems().add("ALL");
contractor.bind(contractorChoice.getSelectionModel().selectedItemProperty());
contractorChoice.getSelectionModel().select("ALL");
// Not yet implemented.
contractorChoice.setDisable(true);
addRow(1, new Label("Contractor:"), contractorChoice);
CheckBox box = new CheckBox();
box.setAllowIndeterminate(false);
box.setSelected(false);
extraReported.bind(box.selectedProperty());
addRow(2, new Label("Show reported extra"), box);
DatePicker startPicker = new DatePicker(LocalDate.of(LocalDate.now().getYear(), 01, 01));
start = startPicker.valueProperty();
DatePicker endPicker = new DatePicker(LocalDate.of(LocalDate.now().getYear(), 12, 31));
end = endPicker.valueProperty();
addRow(3, new Label("Start:"), startPicker);
addRow(4, new Label("End:"), endPicker);
Button okButton = new Button("Ok");
okButton.setOnAction(e -> {
ok = true;
Ui.closeWindowOf(this);
});
Button cancel = new Button("Abbrechen");
cancel.setOnAction(e -> Ui.closeWindowOf(this));
FlowPane p = new FlowPane(10, 0, okButton, cancel);
p.setAlignment(CENTER_RIGHT);
add(p, 0, 5, 2, 1);
}
示例15: OptionPane
import javafx.scene.layout.FlowPane; //导入方法依赖的package包/类
public OptionPane() {
super();
HBox header = new HBox();
header.setAlignment(Pos.CENTER);
headerTxt = new Text("Menu");
headerTxt.getStyleClass().add("option_Text");
HBox.setMargin(headerTxt, new Insets(10, 0, 0 ,0));
header.getChildren().add(headerTxt);
this.getChildren().add(header);
FlowPane pane = new FlowPane ();
pane.setAlignment(Pos.CENTER);
pane.setVgap(20);
pane.setHgap(20);
pane.setPadding(new Insets(20, 20, 20, 20));
pane.prefWidthProperty().bind(this.widthProperty());
OptionButton mp3Btn = new OptionButton(this, "mp3.png", "Import Mp3", "Importer", true);
pane.getChildren().add(mp3Btn);
OptionButton stationBtn = new OptionButton(this, "station.png", "Import station", "importStation", false);
pane.getChildren().add(stationBtn);
OptionButton webBtn = new OptionButton(this, "web.png", "Web interface", "webInterface", false);
pane.getChildren().add(webBtn);
OptionButton settingsBtn = new OptionButton(this, "settings.png", "Settings", "settings", false);
pane.getChildren().add(settingsBtn);
this.getChildren().add(pane);
pane.prefWidthProperty().bind(this.widthProperty());
pane.prefHeightProperty().bind(this.heightProperty());
VBox.setVgrow(this, Priority.ALWAYS);
}