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


Java VBox.setAlignment方法代码示例

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


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

示例1: CheckBoxControl

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public CheckBoxControl(String name) {
	super(name, FlashboardSendableType.CHECKBOX);
	
	checkBox = new CheckBox(name);
	checkBox.selectedProperty().addListener((obs, o, n)->{
		if(localChange)
			return;
		synchronized (valueMutex) {
			lChanged = true;
			value = n.booleanValue();
			send[0] = (byte) (value? 1: 0);
		}
	});
	
	root = new VBox();
	root.setAlignment(Pos.CENTER);
	root.getChildren().add(checkBox);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:19,代码来源:CheckBoxControl.java

示例2: display

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public static void display(String title, String message)
{
	Stage window= new Stage();
	window.initModality(Modality.APPLICATION_MODAL);
	window.setAlwaysOnTop(true);
	window.getIcons().add(new Image("/pic/slogo.png"));
	window.setTitle(title);
	Label label= new Label();
	label.setText(message);
	label.setStyle("-fx-font-size:14px;");
	
	ImageView imageView = new ImageView(ICON);
	imageView.setFitWidth(40);
	imageView.setFitHeight(40);
       Label labelimage = new Label("",imageView);
	
	// two buttons
	Button okbtn= new Button("Ok");
	okbtn.setOnAction(e -> {
		answer= false;
		window.close();
	});
	okbtn.setId("blue");
	HBox hbox= new HBox(10);
	hbox.setAlignment(Pos.CENTER_LEFT);
	hbox.setPadding(new Insets(10,5,10,5));
	hbox.getChildren().addAll(labelimage,label);
	VBox layout= new VBox(15);
	layout.setAlignment(Pos.CENTER_RIGHT);
	layout.setPadding(new Insets(10,5,10,5));
	layout.getChildren().addAll(hbox,okbtn);
	layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
	Scene scene= new Scene(layout);
	window.setScene(scene);
	scene.getStylesheets().add(SuccessMessage.class.getResource("confirm.css").toExternalForm());
	window.setResizable(false);
	window.showAndWait();
}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:39,代码来源:SuccessMessage.java

示例3: displayAlert

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public void displayAlert(String title, String message) {
	Stage window = new Stage();
	window.setResizable(false);
	window.setMinWidth(200);
	window.initModality(Modality.APPLICATION_MODAL);
	window.setTitle(title);

	Label label = new Label();
	label.setText(message);
	Button closeButton = new Button("Ok");
	closeButton.setOnAction(e -> window.close());

	VBox layout = new VBox(10);
	layout.setPadding(new Insets(20));
	layout.getChildren().addAll(label, closeButton);
	layout.setAlignment(Pos.CENTER);

	Scene scene = new Scene(layout);
	window.setScene(scene);
	window.showAndWait();
}
 
开发者ID:edwardxia,项目名称:board-client,代码行数:22,代码来源:GameRoomController.java

示例4: LineChartControl

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public LineChartControl(String name) {
	super(name, FlashboardSendableType.LINECHART);
	
	axisX = new NumberAxis();
	axisX.setForceZeroInRange(false);
	axisX.setAutoRanging(false);
	axisX.setUpperBound(maxX);
	axisX.setLowerBound(minX);
	axisY = new NumberAxis();
	axisY.setForceZeroInRange(false);
	axisY.setAutoRanging(false);
	axisY.setUpperBound(maxY);
	axisY.setLowerBound(minY);
	
	chart = new LineChart<Number, Number>(axisX, axisY);
	chart.setLegendVisible(false);
	chart.setAnimated(false);
	
	chartSeries = new LineChart.Series<Number, Number>();
	chart.setTitle(name);
	chart.getData().add(chartSeries);
	
	root = new VBox();
	root.setAlignment(Pos.CENTER);
	root.setMaxSize(WIDTH, HEIGHT);
	root.getChildren().add(chart);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:28,代码来源:LineChartControl.java

示例5: getLeft

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Node getLeft () {
    VBox vbox = new VBox(Double.parseDouble(myBundle.getString("VSpacing")));
    vbox.setAlignment(Pos.TOP_CENTER);
    vbox.getChildren().add(getView());
    vbox.getChildren().add(getGap());
    vbox.getChildren().add(myFactory.createButton(myLang.getString("Clear"), e -> reset()));
    return vbox;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:9,代码来源:SpawnerView.java

示例6: makeVBox

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public VBox makeVBox (double spacing, Pos alignment, Node ... content) {
    VBox box = new VBox(spacing);
    if (content != null) {
        box.getChildren().addAll(content);
    }
    box.setAlignment(alignment);
    return box;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:9,代码来源:BasicUIFactory.java

示例7: createRegisterControlPanel

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Node createRegisterControlPanel()
{
	BorderPane registerPanel = new BorderPane();
	
	Label watchRegisterLabel = new Label("Watch Register: ");
	registerPanel.setLeft(watchRegisterLabel);
	setAlignment(watchRegisterLabel, Pos.CENTER);
	
	TextField registerNameField = new TextField();
	registerPanel.setCenter(registerNameField);
	setAlignment(registerNameField, Pos.CENTER);
	
	Button watchRegisterButton = new Button("Add");
	watchRegisterButton.setOnAction((event) -> watchRegister(registerNameField
			.getText()));
	registerPanel.setRight(watchRegisterButton);
	setAlignment(watchRegisterButton, Pos.CENTER);
	
	Pair<Node, ComboBox<String>> optionsRowPair = createDisplayOptionsRow();
	Node displayOptions = optionsRowPair.getKey();
	ComboBox<String> displayDropdown = optionsRowPair.getValue();
	displayDropdown.setOnAction((event) -> {
		String selection = displayDropdown.getSelectionModel().getSelectedItem();
		Function<Long, String> function = valueDisplayOptions.get(selection);
		registerDisplayFunction.set(function);
	});
	
	VBox controlPanel = new VBox();
	controlPanel.getChildren().add(registerPanel);
	controlPanel.getChildren().add(displayOptions);
	controlPanel.setAlignment(Pos.CENTER);
	setAlignment(controlPanel, Pos.CENTER);
	controlPanel.setPadding(new Insets(CP_PADDING));
	controlPanel.setSpacing(CP_SPACING);
	
	return controlPanel;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:38,代码来源:WatcherWindow.java

示例8: AreaChartControl

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public AreaChartControl(String name) {
	super(name, FlashboardSendableType.AREACHART);
	
	axisX = new NumberAxis();
	axisX.setForceZeroInRange(false);
	axisX.setAutoRanging(false);
	axisX.setUpperBound(maxX);
	axisX.setLowerBound(minX);
	axisY = new NumberAxis();
	axisY.setForceZeroInRange(false);
	axisY.setAutoRanging(false);
	axisY.setUpperBound(maxY);
	axisY.setLowerBound(minY);
	
	chart = new AreaChart<Number, Number>(axisX, axisY);
	chart.setLegendVisible(false);
	chart.setAnimated(false);
	
	chartSeries = new AreaChart.Series<Number, Number>();
	chart.setTitle(name);
	chart.getData().add(chartSeries);
	
	root = new VBox();
	root.setAlignment(Pos.CENTER);
	root.setMaxSize(WIDTH, HEIGHT);
	root.getChildren().add(chart);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:28,代码来源:AreaChartControl.java

示例9: buildUI

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private Parent buildUI() {
	fc = new FileChooser();
	fc.getExtensionFilters().clear();
	ExtensionFilter jpgFilter = new ExtensionFilter("JPG, JPEG images", "*.jpg", "*.jpeg", "*.JPG", ".JPEG");
	fc.getExtensionFilters().add(jpgFilter);
	fc.setSelectedExtensionFilter(jpgFilter);
	fc.setTitle("Select a JPG image");
	lstLabels = new ListView<>();
	lstLabels.setPrefHeight(200);
	Button btnLoad = new Button("Select an Image");
	btnLoad.setOnAction(e -> validateUrlAndLoadImg());

	HBox hbBottom = new HBox(10, btnLoad);
	hbBottom.setAlignment(Pos.CENTER);

	loadedImage = new ImageView();
	loadedImage.setFitWidth(300);
	loadedImage.setFitHeight(250);
	
	Label lblTitle = new Label("Label image using TensorFlow");
	lblTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 40));
	VBox root = new VBox(10,lblTitle, loadedImage, new Label("Results:"), lstLabels, hbBottom);
	root.setAlignment(Pos.TOP_CENTER);
	return root;
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:26,代码来源:App.java

示例10: simpleInfoBox

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
 * Zeigt ein kleines Infofenster an. Der User muss das Fenster schliessen,
 * bevor er andere Fenster der Anwendung bedienen kann. Die Breite des
 * Fensters passt sich dem Text an.
 * 
 * @param title
 *            Der Titel des Fensters
 * @param message
 *            Die Narchricht, die angezeigt wird. Text wird nicht von selbst
 *            gewrapt.
 * @param button
 *            Text des Buttons
 */
public static void simpleInfoBox (String title, String message, String button)
{
	Stage window = buildWindow(title);
	Label l = new Label(message);
	Button b = new Button(button);

	b.setOnAction(e -> window.close());

	VBox layout = new VBox(20);
	layout.getChildren().addAll(l, b);
	layout.setAlignment(Pos.CENTER);

	// Passt Breite des Fensters an den Text an
	int width;
	int x = 6;
	int y = 150;
	width = message.length() * x + y;

	layout.setOnKeyReleased(e ->
	{
		if (e.getCode() == KeyCode.ESCAPE)
			window.close();
	});
	
	window.setScene(new Scene(layout, width, 150));
	window.show();
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:41,代码来源:Alert.java

示例11: simpleString

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
/**
 * Kleines Fenster, dass Input (String) vom User abfragt.
 * 
 * @param title
 *            Der Titel des Fensters
 * @param message
 *            Die Narchricht, die angezeigt wird. Text wird nicht von selbst
 *            gewrapt.
 * @param fieldWidth
 *            Setzt die Breite des Textfeldes
 * @return String mit dem Userinput
 */
public static String simpleString (String title, String message, String field, double fieldWidth)
{
	Stage window = buildWindow(title);

	Label l = new Label(message);

	TextField tf = new TextField(field);
	tf.setMaxWidth(fieldWidth);

	tf.setOnKeyReleased(e -> {
		if (e.getCode().equals(KeyCode.ENTER))
		{
			tempOutput = tf.getText();
			window.close();
		}
	});
	
	Button b = new Button("_OK");
	b.setOnAction(e ->
	{
		tempOutput = tf.getText();
		window.close();
	});

	VBox layout = new VBox(20);
	layout.getChildren().addAll(l, tf, b);
	layout.setAlignment(Pos.CENTER);
	layout.setPadding(new Insets(20));

	int width;
	int x = 6;
	int y = 150;

	width = message.length() * x + y;
	
	layout.setOnKeyReleased(e ->
	{
		if (e.getCode() == KeyCode.ESCAPE)
			window.close();
	});
	
	window.setScene(new Scene(layout, width, 150));
	window.showAndWait();
	output = tempOutput;
	tempOutput = null;
	return output;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:60,代码来源:Alert.java

示例12: HyperlinkSample

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
public HyperlinkSample() {
    super(400,100);
    ImageView iv = new ImageView(ICON_48);
    VBox vbox = new VBox();
    vbox.setSpacing(5);
    vbox.setAlignment(Pos.CENTER_LEFT);

    Hyperlink h1 = new Hyperlink("Hyperlink");
    Hyperlink h2 = new Hyperlink("Hyperlink with Image");
    h2.setGraphic(iv);

    vbox.getChildren().add(h1);
    vbox.getChildren().add(h2);
    getChildren().add(vbox);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:HyperlinkSample.java

示例13: start

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public void start(Stage window) throws Exception {
    window.setTitle("Library Manager");

    //Username Field
    TextField usernameField = new TextField();
    usernameField.setPromptText("Username");
    usernameField.setMaxWidth(200);

    //Password Field

    PasswordField passwordField = new PasswordField();
    passwordField.setPromptText("Password");
    passwordField.setMaxWidth(200);

    // Login Button
    loginBtn = new Button("Login");
    loginBtn.setOnAction(e -> {
        try {

            String query = "select * from Users where Username=?";
            pst = conn.prepareStatement(query);
            pst.setString(1, usernameField.getText());
            rs = pst.executeQuery();
            if (JavaPasswordSecurity.validatePassword(passwordField.getText(), rs.getString("Password"))) {
                String query_isAdmin = "select * from Users WHERE Username =?";
                pst = conn.prepareStatement(query_isAdmin);
                pst.setString(1, usernameField.getText());
                rs = pst.executeQuery();
                int is_Admin = Integer.parseInt(rs.getString("Is_Admin"));

                if (is_Admin == 1) {
                    System.out.println("Admin");
                    window.hide();
                    adminpage = Admin.adminPage();
                    adminpage.show();
                } else if (is_Admin == 0) {
                    System.out.println("staff");
                }

            } else {
                Alert loginError = new Alert(Alert.AlertType.ERROR);
                loginError.setTitle("Error");
                loginError.setContentText("Login Failed\nPlease Check Username and Password...");
                loginError.setHeaderText(null);
                loginError.showAndWait();
            }


        } catch (Exception err) {
            Alert SqlError = new Alert(Alert.AlertType.ERROR);
            SqlError.setTitle("Error");
            SqlError.setContentText("SQL Error:\n" + err);
            SqlError.setHeaderText(null);
            SqlError.showAndWait();
        }

    });

    CheckConnection();

    //Layout
    VBox layout = new VBox(20);
    layout.getChildren().addAll(usernameField, passwordField, loginBtn);
    layout.setAlignment(Pos.CENTER);

    Scene mainScene = new Scene(layout, 330, 400);

    window.setScene(mainScene);
    window.show();
}
 
开发者ID:MouliBeesetti,项目名称:Library_Manager,代码行数:72,代码来源:Main.java

示例14: getActionPane

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
private VBox getActionPane(){
	progress= new Text("Gate\nEntry Progress");
	progress.setTextAlignment(TextAlignment.CENTER);
	progress.setFont(Font.font("Times New Roman", 35));
	lname= new Label("-Your Name here-");

	Image iconf= new Image(AllAttendance.class.getResourceAsStream("/pic/finger.png"));
	ImageView ivconf= new ImageView(iconf);
	lpic= new Label();
	lpic.setGraphic(ivconf);

	Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
	ImageView imagvw= new ImageView(img1);
	imagvw.setFitHeight(70);
	imagvw.setFitWidth(70);
	lnotexist= new Label("",imagvw);
	lnotexist.setText("\n\n\n\n\nN/A");
	lnotexist.setFont(Font.font("Cooper Black", 15));
	lnotexist.setVisible(false);

	txtfinger= new TextField();
	txtfinger.setEditable(false);
	txtfinger.setMaxWidth(160);		
	txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");

	txtsearch= new TextField();
	initFilter();

	Button btnadd= new Button("save");
	btnadd.setOnAction(e -> {
		setAddAttendance();
	});

	Button btnView= new Button("View Records");
	Button btnCloseView= new Button("Hide Records");

	btnView.setOnAction(e -> {
		timelineDown.play();
	});
	btnCloseView.setOnAction(e -> {
		timelineUp.play();
	});

	VBox laywrong= new VBox();
	laywrong.getChildren().addAll(lnotexist);
	laywrong.setPadding(new Insets(0,0,0,0));
	laywrong.setAlignment(Pos.CENTER);

	HBox laytest= new HBox(5);
	laytest.getChildren().addAll(txtfinger  /* btnadd*/);
	laytest.setAlignment(Pos.CENTER);
	//btnadd was beside txtfinger

	VBox laybtnsearch= new VBox();
	laybtnsearch.getChildren().addAll(txtsearch);
	laybtnsearch.setAlignment(Pos.CENTER);
	laybtnsearch.setPadding(new Insets(20,0,0,0));

	HBox laybtn= new HBox(5);
	laybtn.getChildren().addAll(btnView, btnCloseView);
	laybtn.setAlignment(Pos.CENTER);
	VBox lay1= new VBox(10);
	lay1.getChildren().addAll(progress, lpic, lname, laytest);
	lay1.setAlignment(Pos.CENTER);
	VBox layside= new VBox(25);
	layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
	layside.setAlignment(Pos.TOP_CENTER);
	layside.setMinWidth(230);
	layside.setPadding(new Insets(20,0,10,0));
	return layside;
}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:72,代码来源:AllAttendance.java

示例15: constructContainer

import javafx.scene.layout.VBox; //导入方法依赖的package包/类
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));

	
	btnUserMgmt = new AppButton("Benutzerverwaltung");
	
	btnGroupMgmt = new AppButton("Gruppenverwaltung");
	
	home = new HomeButton(getFXController());
	
	AllFields.getChildren().addAll(btnUserMgmt, btnGroupMgmt, home);
	
	bp.setCenter(AllFields);
	
	btnUserMgmt.setOnAction(e -> getFXController().showView("userview"));
	btnGroupMgmt.setOnAction(e -> getFXController().showView("groupview"));
	
	return bp;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:27,代码来源:ManagementSelectionView.java


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