当前位置: 首页>>代码示例>>Java>>正文


Java StackPane.setAlignment方法代码示例

本文整理汇总了Java中javafx.scene.layout.StackPane.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java StackPane.setAlignment方法的具体用法?Java StackPane.setAlignment怎么用?Java StackPane.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.StackPane的用法示例。


在下文中一共展示了StackPane.setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ToggleSwitchSkin

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
/**
 * Constructor for all SkinBase instances.
 *
 * @param control The control for which this Skin should attach to.
 */
protected ToggleSwitchSkin(ToggleSwitch control) {
    super(control);

    thumb = new StackPane();
    thumbArea = new StackPane();
    label = new LabeledText(control);
    labelContainer = new StackPane();

    updateLabel(control);
    getChildren().addAll(labelContainer, thumbArea, thumb);
    labelContainer.getChildren().addAll(label);
    StackPane.setAlignment(label, Pos.CENTER_LEFT);

    thumb.getStyleClass().setAll("thumb");
    thumbArea.getStyleClass().setAll("thumb-area");

    thumbArea.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
    thumb.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
    control.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue.booleanValue() != oldValue.booleanValue())
            selectedStateChanged();
    });
}
 
开发者ID:thane98,项目名称:FEFEditor,代码行数:29,代码来源:ToggleSwitchSkin.java

示例2: 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);
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:26,代码来源:TitleBarComponent.java

示例3: Indicator

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
public Indicator() {
    Circle c = new Circle(5);
    Line l = new Line();
    l.setStartX(0);
    l.endXProperty().bind(this.widthProperty().subtract(10));
    c.getStyleClass().add("timeindicator");
    l.getStyleClass().add("timeindicator");

    StackPane.setAlignment(c, Pos.CENTER_LEFT);
    this.getChildren().add(l);
    this.getChildren().add(c);
    this.translateYProperty().bind(this.heightProperty().divide(2).negate());
}
 
开发者ID:Jibbow,项目名称:FastisFX,代码行数:14,代码来源:TimeIndicator.java

示例4: wrap

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
@Override
protected Node wrap(Node node) {
    StackPane outerPane = new StackPane();
    outerPane.setStyle("-fx-padding: 20px;");

    StackPane stackPane = new StackPane();
    stackPane.setStyle(
            "-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
    outerPane.getChildren().add(stackPane);

    StackPane.setAlignment(node, Pos.CENTER);
    stackPane.getChildren().add(node);

    return outerPane;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:16,代码来源:CalendarFXDateControlSample.java

示例5: productbyType

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
public static BorderPane productbyType(String type) {

        BorderPane products = new BorderPane();
        products.setPadding(new Insets(10,20,10,20));

        Connection con = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;

        String query = DBUtils.prepareSelectQuery(" * ",
                " classroomflipkart.productdetail AS T ," +
                        " ( "+ DBUtils.prepareSelectQuery("productId",
                                " classroomflipkart.homeproducts ",
                                "type = '"+type+"'")+
                        " ) AS S",
                " T.productId = S.productId ");

        try {
            con = DBUtils.getConnection();
            stmt = con.prepareStatement(query);
            rs = stmt.executeQuery();

            rs.last();
            int size = rs.getRow();

            if (size>0){
                rs.beforeFirst();

                Label title = new Label(type+"");
                title.setFont(Font.font("Open Sans", FontWeight.BOLD,17));
                title.setPadding(new Insets(10));
                title.setAlignment(Pos.CENTER);

                HBox productList = new HBox(20);
                productList.setAlignment(Pos.CENTER);

                while (rs.next()) {
                    String productId = rs.getString("productId");
                    String productName = rs.getString("productName");
                    String newPrice = rs.getString("newPrice");
                    String oldPrice = rs.getString("oldPrice");
                    String category = rs.getString("category");
                    String subcategory = rs.getString("subcategory");
                    String imageName = rs.getString("imageName");
                    String productAvailability = rs.getString("productAvailability");

                    productList.getChildren().add(productDetail.productByType(productId,productName,newPrice,oldPrice,category,subcategory,imageName, productAvailability));
                }

                ScrollPane proScroller = new ScrollPane(productList);
                proScroller.setFitToHeight(true);
                proScroller.setFitToWidth(true);
                proScroller.setPannable(true);
                proScroller.setPadding(new Insets(0,0,30,0));

                StackPane titlePane = new StackPane(title);
                titlePane.setAlignment(Pos.CENTER);

                StackPane productPane = new StackPane(proScroller);
                productPane.setAlignment(Pos.CENTER);

                products.setTop(titlePane);
                products.setCenter(productPane);
            }


        } catch (Exception e) {
            products.setCenter(new Label(e.getMessage()));
            e.printStackTrace();
        } finally {
            DBUtils.closeAll(rs, stmt, con);
            return products;
        }
    }
 
开发者ID:madHEYsia,项目名称:ClassroomFlipkart,代码行数:75,代码来源:fetchProducts.java

示例6: addCanvasToRootPane

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
private void addCanvasToRootPane(Image image) {
    if (image == null) {
        return;
    }
    rootPane.setPrefWidth(image.getWidth());
    rootPane.setPrefHeight(image.getHeight());
    rootPane.getChildren().add(canvas);
    StackPane.setAlignment(canvas, Pos.TOP_CENTER);
}
 
开发者ID:luxmeter,项目名称:puzzlefx,代码行数:10,代码来源:Controller.java

示例7: initLooks

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
private void initLooks(){
    rectangle.setStrokeWidth(STROKE_WIDTH);
    rectangle.setFill(Color.LIGHTSKYBLUE);
    rectangle.setStroke(Color.BLACK);
    StackPane.setAlignment(title, Pos.CENTER);
    VBox.setMargin(attributes, new Insets(5,0,0,5));
    VBox.setMargin(operations, new Insets(5,0,0,5));
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:9,代码来源:ClassNodeView.java

示例8: initLooks

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
private void initLooks(){
    rectangle.setStrokeWidth(STROKE_WIDTH);
    rectangle.setFill(Color.LIGHTSKYBLUE);
    rectangle.setStroke(Color.BLACK);
    StackPane.setAlignment(title, Pos.CENTER);
    VBox.setMargin(values, new Insets(5,0,0,5));
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:8,代码来源:EnumerationNodeView.java

示例9: PackageNodeView

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
public PackageNodeView(PackageNode node) {
    super(node);
    refNode = node;
    title = new Text(node.getTitle());
    title.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
    //TODO Ugly solution, hardcoded value.
    title.setWrappingWidth(node.getWidth() - 7);
    container = new VBox();
    bodyStackPane = new StackPane();

    container.setSpacing(0);

    createRectangles();


    container.getChildren().add(top);
    bodyStackPane.getChildren().addAll(body, title);
    container.getChildren().addAll(bodyStackPane);
    StackPane.setAlignment(title, Pos.TOP_CENTER);
    StackPane.setAlignment(top, Pos.CENTER_LEFT);
    setTitleSize();
    this.getChildren().add(container);
    this.setTranslateX(node.getTranslateX());
    this.setTranslateY(node.getTranslateY());

    createHandles();
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:28,代码来源:PackageNodeView.java

示例10: initUi

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
private void initUi() {
    root.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
    root.getStyleClass().add(STYLE_CLASS);

    playButton.setGraphic(Svg.PLAY.node());
    pauseButton.setGraphic(Svg.PAUSE.node());
    stopButton.setGraphic(Svg.STOP.node());

    HBox labelBox = new HBox(currentTimeLabel, finalTimeLabel);
    labelBox.setMaxWidth(Region.USE_PREF_SIZE);
    labelBox.setAlignment(Pos.CENTER_LEFT);
    StackPane.setAlignment(labelBox, Pos.CENTER_RIGHT);

    currentTimeLabel.getStyleClass().add(CURRENT_TIME_LABEL_STYLE_CLASS);

    HBox buttonBox = new HBox(playButton, pauseButton, stopButton);
    buttonBox.getStyleClass().add(BUTTON_BOX_STYLE_CLASS);
    buttonBox.setMaxWidth(Region.USE_PREF_SIZE);

    root.getChildren().addAll(buttonBox, labelBox);
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:22,代码来源:PlayerComponent.java

示例11: start

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
    double[] values = new double[]{50,166,200,106,94,211,172,133,132,185,152,131,158,180,172,314,262,160};

    //---->Default graph using plotter<----
    LineGraph graph = new LineGraph(400,200, Theme.TRAFFIC);
    graph.setInterval(20);

    //Populating the graph
    for (double value : values) {
        graph.addValue(value);
    }

    graph.render(LineGraph.Render.ALL);

    StackPane background = new StackPane();
    background.setPrefHeight(300);
    background.setPrefWidth(600);
    background.setStyle("-fx-background-color: radial-gradient(center 50% 50%, radius 100%, #2a367f, #1f2756)");

    background.getChildren().add(graph);
    StackPane.setAlignment(graph, Pos.CENTER);

    StackPane axis = new StackPane();
    axis.setMaxSize(500,50);
    Line divider = new Line(50,0,550,0);
    divider.setStroke(Color.WHITE);
    divider.setOpacity(0.3);
    axis.getChildren().add(divider);
    StackPane.setAlignment(divider,Pos.CENTER);
    Label time1 = new Label("8am");
    Label time2 = new Label("5pm");
    time1.setTextFill(Color.WHITE);
    time2.setTextFill(Color.WHITE);
    time1.setOpacity(0.5);
    time2.setOpacity(0.5);
    time1.setFont(Font.font("Calibri",16));
    time2.setFont(Font.font("Calibri",16));
    axis.getChildren().addAll(time1,time2);
    StackPane.setAlignment(time1,Pos.BOTTOM_LEFT);
    StackPane.setMargin(time1, new Insets(0,0,0,30));
    StackPane.setAlignment(time2, Pos.BOTTOM_RIGHT);
    StackPane.setMargin(time2, new Insets(0,30,0,0));

    background.getChildren().add(axis);
    StackPane.setAlignment(axis, Pos.BOTTOM_CENTER);
    StackPane.setMargin(axis, new Insets(0,0,40,0));

    primaryStage.setScene(new Scene(background));
    primaryStage.setTitle("Traffic");
    primaryStage.show();
}
 
开发者ID:DrMerfy,项目名称:GraphCreator,代码行数:53,代码来源:Traffic.java

示例12: init

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
private void init() {
	setPadding(new Insets(GuiConstants.padding));

	HBox center = new HBox(GuiConstants.padding);
	getChildren().add(center);
	StackPane.setAlignment(center, Pos.CENTER);
	center.setAlignment(Pos.CENTER);

	matchClassButton.setText("match classes");
	matchClassButton.setOnAction(event -> matchClasses());
	matchClassButton.setDisable(true);

	center.getChildren().add(matchClassButton);

	matchMemberButton.setText("match members");
	matchMemberButton.setOnAction(event -> matchMembers());
	matchMemberButton.setDisable(true);

	center.getChildren().add(matchMemberButton);

	matchPerfectMembersButton.setText("match 100% members");
	matchPerfectMembersButton.setOnAction(event -> matchPerfectMembers());
	matchPerfectMembersButton.setDisable(true);

	center.getChildren().add(matchPerfectMembersButton);

	HBox right = new HBox(GuiConstants.padding);
	getChildren().add(right);
	StackPane.setAlignment(right, Pos.CENTER_RIGHT);
	right.setAlignment(Pos.CENTER_RIGHT);
	right.setPickOnBounds(false);

	unmatchClassButton.setText("unmatch classes");
	unmatchClassButton.setOnAction(event -> unmatchClass());
	unmatchClassButton.setDisable(true);

	right.getChildren().add(unmatchClassButton);

	unmatchMemberButton.setText("unmatch members");
	unmatchMemberButton.setOnAction(event -> unmatchMember());
	unmatchMemberButton.setDisable(true);

	right.getChildren().add(unmatchMemberButton);

	SelectListener selectListener = new SelectListener();
	srcPane.addListener(selectListener);
	dstPane.addListener(selectListener);
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:49,代码来源:BottomPane.java

示例13: start

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Checkbox Sample");
    stage.setWidth(250);
    stage.setHeight(150);

    rect.setArcHeight(10);
    rect.setArcWidth(10);
    rect.setFill(Color.rgb(41, 41, 41));

    for (int i = 0; i < names.length; i++) {
        final Image image = images[i] =
            new Image(getClass().getResourceAsStream(names[i] + ".png"));
        final ImageView icon = icons[i] = new ImageView();
        final CheckBox cb = cbs[i] = new CheckBox(names[i]);
        cb.selectedProperty().addListener(
                (ObservableValue<? extends Boolean> ov,
                Boolean old_val, Boolean new_val) -> {
                    icon.setImage(new_val ? image : null);                
        });
    }
    
    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);

    HBox hbox = new HBox();
    hbox.getChildren().addAll(icons);
    hbox.setPadding(new Insets(0, 0, 0, 5));

    StackPane stack = new StackPane();

    stack.getChildren().add(rect);
    stack.getChildren().add(hbox);
    StackPane.setAlignment(rect, Pos.TOP_CENTER);                

    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(stack);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

    stage.setScene(scene);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:49,代码来源:CheckboxSample.java

示例14: createStackPane

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
public static StackPane createStackPane(double width, double height, Pos alignment)
{
	StackPane pane = createStackPane(width, height);
	pane.setAlignment(alignment);
	return pane;
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:7,代码来源:JavaFxHelper.java

示例15: initLooks

import javafx.scene.layout.StackPane; //导入方法依赖的package包/类
private void initLooks(){
    rectangle.setStrokeWidth(STROKE_WIDTH);
    rectangle.setFill(Color.LIGHTSKYBLUE);
    rectangle.setStroke(Color.BLACK);
    StackPane.setAlignment(title, Pos.CENTER);
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:7,代码来源:SequenceObjectView.java


注:本文中的javafx.scene.layout.StackPane.setAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。