本文整理汇总了Java中javafx.scene.layout.StackPane类的典型用法代码示例。如果您正苦于以下问题:Java StackPane类的具体用法?Java StackPane怎么用?Java StackPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StackPane类属于javafx.scene.layout包,在下文中一共展示了StackPane类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.layout.StackPane; //导入依赖的package包/类
@Override public void start(Stage stage) {
StackPane pane = new StackPane(graph);
pane.setPadding(new Insets(10));
pane.setBackground(new Background(new BackgroundFill(Color.rgb(40, 40, 40), CornerRadii.EMPTY, Insets.EMPTY)));
Scene scene = new Scene(pane);
stage.setTitle("Radial Chart");
stage.setScene(scene);
stage.show();
timer.start();
}
示例2: show
import javafx.scene.layout.StackPane; //导入依赖的package包/类
public void show() {
textArea = new JFXTextArea(bodyText);
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(textArea);
content.setPrefSize(dialogWidth, dialogHeight);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button = new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
dialog.show();
}
示例3: start
import javafx.scene.layout.StackPane; //导入依赖的package包/类
@Override public void start(Stage stage) {
GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(10));
gridPane.setHgap(10);
gridPane.setVgap(10);
gridPane.add(lineChart, 0, 0);
gridPane.add(areaChart, 1, 0);
gridPane.add(smoothLineChart, 0, 1);
gridPane.add(smoothAreaChart, 1, 1);
gridPane.add(scatterChart, 0, 2);
gridPane.add(donutChart, 1, 2);
Scene scene = new Scene(new StackPane(gridPane));
stage.setTitle("Charts");
stage.setScene(scene);
stage.show();
timer.start();
modificationThread.start();
}
示例4: EnumerationNodeView
import javafx.scene.layout.StackPane; //导入依赖的package包/类
public EnumerationNodeView(EnumerationNode node) {
super(node);
//setChangeListeners();
container = new StackPane();
rectangle = new Rectangle();
vbox = new VBox();
container.getChildren().addAll(rectangle, vbox);
initVBox();
createRectangles();
changeHeight(node.getHeight());
changeWidth(node.getWidth());
initLooks();
this.getChildren().add(container);
this.setTranslateX(node.getTranslateX());
this.setTranslateY(node.getTranslateY());
createHandles();
}
示例5: init
import javafx.scene.layout.StackPane; //导入依赖的package包/类
@Override public void init() throws Exception {
root = new StackPane();
background = new StackPane();
background.setId("Window");
background.setCache(true);
ImageView carImageView = new ImageView(new Image(
DataAppPreloader.class.getResourceAsStream("images/car.png")));
raceTrack = new RaceTrack();
root.getChildren().addAll(background, raceTrack, carImageView);
Platform.runLater(new Runnable() {
@Override public void run() {
preloaderScene = new Scene(root,1250,750);
preloaderScene.getStylesheets().add(
DataAppPreloader.class.getResource("preloader.css").toExternalForm());
}
});
}
示例6: displayLetter
import javafx.scene.layout.StackPane; //导入依赖的package包/类
public static void displayLetter(Pane parent, LetterInterface letter, boolean draggable) {
Text tileText = new Text(LetterToStringTransformer.transform(letter));
tileText.getStyleClass().add("tile-letter");
Text tileValue = new Text(String.valueOf(letter.getValue()));
tileValue.getStyleClass().add("tile-value");
tileValue.setTranslateX(8);
tileValue.setTranslateY(10);
StackPane tile = new StackPane(tileText, tileValue);
tile.getStyleClass().add("tile");
if (draggable) {
DraggableLetterManager.makeLetterDraggable(tile, letter);
}
parent.getChildren().add(tile);
}
示例7: GoogleEntryGMapsFXView
import javafx.scene.layout.StackPane; //导入依赖的package包/类
GoogleEntryGMapsFXView(GoogleEntry entry) {
this.entry = entry;
this.entry.locationProperty().addListener(obs -> updateLocation());
this.mapView.addMapInializedListener(this);
this.mapView.getStyleClass().add("map");
this.mapView.setMouseTransparent(true);
this.mapViewWrapper.getChildren().add(mapView);
this.mapViewWrapper.setVisible(false);
this.mapViewWrapper.managedProperty().bind(this.mapView.visibleProperty());
this.mapViewWrapper.setPrefSize(300, 300);
StackPane stackPane = new StackPane();
stackPane.getStyleClass().add("map-view-wrapper");
stackPane.getChildren().add(mapViewWrapper);
getChildren().add(stackPane);
}
示例8: createContent
import javafx.scene.layout.StackPane; //导入依赖的package包/类
@Override
@FXThread
protected void createContent(@NotNull final StackPane root) {
appStateList = new AppStateList(this::selectAppStateFromList, this);
propertyEditorAppStateContainer = new VBox();
filterList = new FilterList(this::selectFilterFromList, this);
propertyEditorFiltersContainer = new VBox();
layerNodeTree = new LayerNodeTree(this::selectNodeFromLayersTree, this);
propertyEditorLayersContainer = new VBox();
super.createContent(root);
FXUtils.addClassTo(layerNodeTree.getTreeView(), CSSClasses.TRANSPARENT_TREE_VIEW);
}
示例9: createIconContent
import javafx.scene.layout.StackPane; //导入依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
HBox hbox = new HBox(3);
hbox.setAlignment(Pos.CENTER);
Rectangle rectangle = new Rectangle(70, 25, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
hbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
Rectangle r2 = new Rectangle(14, 14, Color.web("#349b00"));
Rectangle r3 = new Rectangle(18, 14, Color.web("#349b00"));
hbox.getChildren().addAll(r1, r2, r3);
sp.getChildren().addAll(rectangle, hbox);
return new Group(sp);
}
示例10: createUi
import javafx.scene.layout.StackPane; //导入依赖的package包/类
private void createUi() {
getStyleClass().add(TITLE_BAR_STYLE_CLASS);
setAlignment(Pos.CENTER_RIGHT);
setMaxWidth(Double.MAX_VALUE);
Region selectedBar = new Region();
selectedBar.getStyleClass().add(HIGHLIGHT_STYLE_CLASS);
selectedBar.setMinWidth(Region.USE_PREF_SIZE);
selectedBar.setMaxHeight(Region.USE_PREF_SIZE);
selectedBar.setMaxWidth(Double.MAX_VALUE);
StackPane.setAlignment(selectedBar, Pos.BOTTOM_CENTER);
StackPane labelPane = new StackPane(label, selectedBar);
labelPane.setMaxHeight(Double.MAX_VALUE);
labelPane.setMaxWidth(Region.USE_PREF_SIZE);
Region filler = new Region();
HBox.setHgrow(filler, Priority.ALWAYS);
rightLabel.getStyleClass().setAll(RIGHT_LABEL_STYLE_CLASS);
new FadeInAnimator().apply(expanded, selectedBar);
new FadeInAnimator().apply(expanded, rightLabel);
getChildren().addAll(labelPane, filler, rightLabel);
}
示例11: show
import javafx.scene.layout.StackPane; //导入依赖的package包/类
/**
* Shows this dialog.
*
* @param owner the owner.
*/
@FXThread
public void show(@NotNull final Window owner) {
final Scene scene = owner.getScene();
if (scene instanceof EditorFXScene) {
final EditorFXScene editorFXScene = (EditorFXScene) scene;
final StackPane container = editorFXScene.getContainer();
container.setFocusTraversable(false);
}
focusOwner = scene.getFocusOwner();
dialog.initOwner(owner);
dialog.show();
dialog.requestFocus();
GAnalytics.sendPageView(getDialogId(), null, "/dialog/" + getDialogId());
GAnalytics.sendEvent(GAEvent.Category.DIALOG, GAEvent.Action.DIALOG_OPENED, getDialogId());
final JFXApplication application = JFXApplication.getInstance();
application.addWindow(dialog);
Platform.runLater(dialog::sizeToScene);
}
示例12: createIconContent
import javafx.scene.layout.StackPane; //导入依赖的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);
}
示例13: createIconContent
import javafx.scene.layout.StackPane; //导入依赖的package包/类
public static Node createIconContent() {
StackPane sp = new StackPane();
AnchorPane anchorPane = new AnchorPane();
Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));
anchorPane.getChildren().addAll(r1, r2, r3);
AnchorPane.setTopAnchor(r1, Double.valueOf(1));
AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
AnchorPane.setTopAnchor(r2, Double.valueOf(20));
AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
AnchorPane.setRightAnchor(r3, Double.valueOf(5));
sp.getChildren().addAll(rectangle, anchorPane);
return new Group(sp);
}
示例14: addState
import javafx.scene.layout.StackPane; //导入依赖的package包/类
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
rectangle.setArcHeight(WIDTH);
rectangle.setArcWidth(WIDTH);
rectangle.setUserData(state);
Label text = new Label(computeStateLabel(stateIndex));
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(STATE_FONT);
text.setMaxWidth(WIDTH);
final Tooltip tooltip = new Tooltip(stateDescription);
Tooltip.install(rectangle, tooltip);
StackPane layout = new StackPane();
StackPane.setMargin(rectangle, MARGIN_INSETS);
layout.getChildren().addAll(rectangle, text);
line.getChildren().add(layout);
}
示例15: createContent
import javafx.scene.layout.StackPane; //导入依赖的package包/类
@Override
@FXThread
protected void createContent(@NotNull final StackPane root) {
createEditorAreaPane();
mainSplitContainer = new EditorToolSplitPane(JFX_APPLICATION.getScene(), root);
editorToolComponent = new ScrollableEditorToolComponent(mainSplitContainer, 1);
editorToolComponent.prefHeightProperty().bind(root.heightProperty());
createToolComponents(editorToolComponent, root);
editorToolComponent.addChangeListener((observable, oldValue, newValue) -> processChangeTool(oldValue, newValue));
editorToolComponent.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> {
final S editorState = getEditorState();
if (editorState != null) editorState.setOpenedTool(newValue.intValue());
});
mainSplitContainer.initFor(editorToolComponent, getEditorAreaPane());
FXUtils.addToPane(mainSplitContainer, root);
FXUtils.addClassTo(mainSplitContainer, CSSClasses.FILE_EDITOR_MAIN_SPLIT_PANE);
}