本文整理汇总了Java中javafx.scene.layout.FlowPane类的典型用法代码示例。如果您正苦于以下问题:Java FlowPane类的具体用法?Java FlowPane怎么用?Java FlowPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FlowPane类属于javafx.scene.layout包,在下文中一共展示了FlowPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
@Override
public void decorate(Node control, Pane container) {
super.decorate(control, container);
control.setStyle(control.getStyle() + "-fx-border-color: green;-fx-hgap:5;-fx-vgap:5;");
FlowPane flow = ((FlowPane) control);
flow.getChildren().clear();
if (vside != null) {
flow.getChildren().addAll(new Rectangle(50, 50, Color.RED), new Rectangle(20, 20, Color.GREEN));
flow.setOrientation(Orientation.HORIZONTAL);
}
if (hside != null) {
flow.getChildren().addAll(new Rectangle(100, 50, Color.RED), new Rectangle(20, 20, Color.GREEN));
flow.setOrientation(Orientation.VERTICAL);
}
}
示例2: 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);
}
示例3: init
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
private void init(Stage primaryStage) {
VBox root = new VBox();
fpsLabel = new Label("FPS:");
fpsLabel.setStyle("-fx-font-size: 5em;-fx-text-fill: red;");
fpsLabel.setOnMouseClicked((event) -> {
tracker.resetAverageFPS();
});
FlowPane flow = new FlowPane();
flow.setCache(true);
flow.setCacheHint(CacheHint.SPEED);
root.getChildren().addAll(fpsLabel,flow);
Scene scene = new Scene(root, 500, 2000);
createPerformanceTracker(scene);
primaryStage.setScene(scene);
List< ScatterChart<Number, Number>> result = new ArrayList<>();
for(int i =0; i<10;i++) {
ScatterChart<Number, Number> tmp = createChart();
result.add(tmp);
}
flow.getChildren().setAll(result);
}
示例4: createSimpleMap
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
/**
* @param tab
* @param btn_clear_directions
* @param btn_show_directions
* @param btn_find_path
* @param btn_clear_path
* @param path_choice_pane
* @param btn_get_coords_find_path
* @param txt_from
* @param txt_to
*/
public void createSimpleMap(final Tab tab, final FlowPane flowPane, final Button btn_clear_directions,
final Button btn_show_directions, final Button btn_find_path,
final Button btn_clear_path, final Pane path_choice_pane,
final Button btn_get_coords_find_path, final TextField txt_from,
final TextField txt_to) {
//generates google map with some defaults and put it into top pane
mapComponent = new GoogleMapView("/html/maps.html");
mapComponent.addMapInializedListener(this);
mapComponent.addMapReadyListener(MOUSE_CLCK_FOR_GET_COORD_LISTENER);
initControls(btn_clear_directions, btn_show_directions, btn_find_path, btn_clear_path, path_choice_pane,
btn_get_coords_find_path, txt_from, txt_to);
mapComponent.getChildren().addAll(flowPane, path_choice_pane);
tab.setContent(mapComponent);
}
示例5: 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;
}
示例6: mergeFailed
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
private void mergeFailed(Exception exception) {
Platform.runLater(() -> {
Text text = new Text(
String.format("Merging failed.\nProblem: %s\nIf you think this is a bug, please report it here:",
exception.getMessage()));
text.setWrappingWidth(CONTENT_WIDTH);
text.setFill(Color.WHITE); // XXX: Ugly workaround because CSS doesn't work
Hyperlink link = buildBugReportLink(exception);
FlowPane content = new FlowPane(text, link);
ThemedAlert alert = new ThemedAlert(AlertType.ERROR);
alert.getDialogPane().setContent(content);
alert.showAndWait();
System.exit(1);
});
}
示例7: addRoom
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
private void addRoom(int roomId, Room room) {
final RoomView roomView = new RoomView(roomId, room);
roomView.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent t) {
if (selectRoom != null) {
selectRoom.setStyle("-fx-border-color: white;");
}
roomView.setStyle("-fx-border-color: red;");
selectRoom = roomView;
}
});
FlowPane.setMargin(roomView, new Insets(20, 0, 0, 40));
roomList.getChildren().add(roomView);
}
示例8: FlowPaneSample
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
public FlowPaneSample() {
super(400, 400);
FlowPane flowPane = new FlowPane(2, 4);
flowPane.setPrefWrapLength(200); //preferred wraplength
Label[] shortLabels = new Label[ITEMS];
Label[] longLabels = new Label[ITEMS];
ImageView[] imageViews = new ImageView[ITEMS];
for (int i = 0; i < ITEMS; i++) {
shortLabels[i] = new Label("Short label.");
longLabels[i] = new Label("I am a slightly longer label.");
imageViews[i] = new ImageView(ICON_48);
flowPane.getChildren().addAll(shortLabels[i], longLabels[i], imageViews[i]);
}
getChildren().add(flowPane);
}
示例9: 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);
}
示例10: start
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList(
new PieChart.Data("Education", 200),
new PieChart.Data("Health", 130),
new PieChart.Data("Defense", 200),
new PieChart.Data("Agriculture", 200)
);
PieChart budget = new PieChart(pieChartData);
budget.setTitle("Economy Divison");
FlowPane root = new FlowPane();
root.getChildren().add(budget);
Scene scene = new Scene(root,500,500);
stage.setTitle("Pie Chart Demo");
stage.setScene(scene);
stage.show();
}
示例11: start
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
@Override
public void start(final Stage primaryStage) throws Exception {
MediaView mediaView = new MediaView();
Media media = new Media(new File("credits/end_scene.mp4").toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaView.setMediaPlayer(mediaPlayer);
mediaPlayer.setAutoPlay(true);
mediaView.setPreserveRatio(false);
List<String> params = getParameters().getRaw();
if(params.size() == 2) {
mediaView.setFitWidth(Integer.parseInt(params.get(0)));
mediaView.setFitHeight(Integer.parseInt(params.get(1)));
} else {
mediaView.setFitWidth(1280);
mediaView.setFitHeight(720);
}
mediaPlayer.setOnEndOfMedia(new Runnable() {
@Override
public void run() {
primaryStage.close();
}
});
primaryStage.setScene(new Scene(new FlowPane(mediaView)));
primaryStage.show();
}
示例12: 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();
}
示例13: 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();
}
示例14: setPlayersInformation
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
private void setPlayersInformation(Player p, Label playerLabel) {
FlowPane playerPane = (FlowPane) playerLabel.getParent();
if (playerPane.getChildren().size() == 2) {
playerPane.getChildren().remove(0);
}
Image img = new Image("resources/player/" + p.getColor() + ".png");
ImageView iv = new ImageView();
iv.setFitWidth(30.0);
iv.setPreserveRatio(true);
iv.setImage(img);
playerLabel.setText("Joueur " + p.getColor() + " > Ressources : " + p.getResources()
+ " | Nombre de Yacks : " + p.getEconomicScore());
playerPane.getChildren().add(0, iv);
}
示例15: start
import javafx.scene.layout.FlowPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
Platform.setImplicitExit(true);
SearchTreePaneController paneBuilder = new SearchTreePaneController(conceptService, uiBundle);
BorderPane node = paneBuilder.getRoot();
FlowPane pane = new FlowPane();
pane.setPrefSize(800, 250);
DragPaneDecorator dragPaneDecorator = new DragPaneDecorator(conceptService, eventBus, uiBundle);
dragPaneDecorator.decorate(pane);
node.setBottom(pane);
Scene scene = new Scene(node, 800, 800);
scene.getStylesheets().add("/css/common.css");
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setOnCloseRequest(e -> {
Platform.exit();
System.exit(0);
});
}