當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。