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


Java Button.setLayoutX方法代码示例

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


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

示例1: createSaveFlightButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createSaveFlightButton(Stage stage){
       Button btnSaveFlight = new Button();
       btnSaveFlight.setLayoutX(10);
       btnSaveFlight.setLayoutY(60);;
       btnSaveFlight.setText("Save Flight");

       btnSaveFlight.setOnAction(       
       new EventHandler<ActionEvent>() {
          @Override
          public void handle(final ActionEvent e) {
       	   FileChooser fileChooser = new FileChooser();
      		   fileChooser.setTitle("Flight plan (xml)");
      		   File file = fileChooser.showSaveDialog(stage);
      		   if (file != null) {
      		       System.out.println("Selected " + file);
      		       try {
      		    	    fzv.setPlanningMode(false);
   				    new SaveXMLFlight(file.getAbsolutePath(),wayPoints);
			   } catch (IOException | FlightZoneException e1) {
   					// TODO Auto-generated catch block
   					e1.printStackTrace();
   			   }     
      	    }
       }});
       return btnSaveFlight;
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:27,代码来源:InteractiveFlightPlannerView.java

示例2: buildMainMenu

import javafx.scene.control.Button; //导入方法依赖的package包/类
private void buildMainMenu(Group root, Scene scene, Dimension screenSize) {
    // Main title
    Label maintitle = new Label();
    maintitle.setText("Chess Master");
    maintitle.setFont(new Font("Arial", MAIN_TITLE_FONT_SIZE));
    maintitle.setLayoutX(MAIN_TITLE_LEFT_PADDING);
    maintitle.setLayoutY(MAIN_TITLE_TOP_PADDING);
    root.getChildren().add(maintitle);

    // Buttons
    Group buttonsGroup = new Group();

    // Start button.
    Button choiceGameButton = new Button();
    choiceGameButton.setLayoutX(screenSize.getWidth() * BUTTON_LEFT_PADDING);
    choiceGameButton.setLayoutY(maintitle.getLayoutY() * 2);
    choiceGameButton.setPrefSize(BUTTONS_WIDTH, BUTTONS_HEIGHT);
    choiceGameButton.setText("Choose your game");
    buttonsGroup.getChildren().add(choiceGameButton);

    // Setting button.
    Button settingButton = new Button();
    settingButton.setLayoutX(screenSize.getWidth() * BUTTON_LEFT_PADDING);
    settingButton.setLayoutY(choiceGameButton.getLayoutY() + BUTTONS_SPACE);
    settingButton.setPrefSize(BUTTONS_WIDTH, BUTTONS_HEIGHT);
    settingButton.setText("Settings");
    buttonsGroup.getChildren().add(settingButton);

    // Quit button.
    Button quitButton = new Button();
    quitButton.setLayoutX(screenSize.getWidth() * BUTTON_LEFT_PADDING);
    quitButton.setLayoutY(settingButton.getLayoutY() + BUTTONS_SPACE);
    quitButton.setPrefSize(BUTTONS_WIDTH, BUTTONS_HEIGHT);
    quitButton.setText("Quit game");
    quitButton.setOnAction(handle -> closeApp());
    buttonsGroup.getChildren().add(quitButton);
    root.getChildren().add(buttonsGroup);

    // Copyright
    Label copyright = new Label();
    copyright.setText("All rights reserved, Nicolas GILLE, 2017");
    copyright.setFont(new Font("Arial", 12));
    copyright.setLayoutX(COPYRIGHT_LEFT_PADDING);
    copyright.setLayoutY(COPYRIGHT_TOP_PADDING);
    root.getChildren().add(copyright);
}
 
开发者ID:Kero76,项目名称:chess-master,代码行数:47,代码来源:View.java

示例3: createNewFlightButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createNewFlightButton(Stage stage){
       Button btnNewFlight = new Button();
       btnNewFlight.setLayoutX(10);
       btnNewFlight.setLayoutY(10);;
       btnNewFlight.setText("Record New Flight");
       btnNewFlight.setOnAction(
       new EventHandler<ActionEvent>() {
          @Override
          public void handle(final ActionEvent e) {
       	   fzv.setPlanningMode(true);
       	}});
       return btnNewFlight;
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:14,代码来源:InteractiveFlightPlannerView.java

示例4: createButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
public Button createButton(String btnText, int width){
	Button btn = new Button();
	btn.setLayoutX(btnXPosition);
	btn.setLayoutY(btnYPosition);
	btn.setPrefWidth(width);
	btn.setText(btnText);
	btnXPosition = btnXPosition + width + 20;
	return btn;
}
 
开发者ID:JaneClelandHuang,项目名称:Dronology,代码行数:10,代码来源:ButtonGenerator.java

示例5: createButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createButton(Pane root, ColorPicker colorPicker) {
	Button okayButton = new Button(myResources.getString("OkayButton"));
	okayButton.setLayoutX(200);
	okayButton.setLayoutY(100);
	okayButton.setId("btnLogin");
	okayButton.setOnAction(e -> {
		root.setBackground(new Background(new BackgroundFill(colorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY)));
		stage.close();
	});
	return okayButton;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:12,代码来源:BackgroundSettingMenuHandler.java

示例6: createButton

import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createButton() {
	Button starting = new Button("Start A Game of Random Level");				
	starting.setLayoutX(500);
	starting.setLayoutY(600);
	starting.setId("starting");
	starting.setMinWidth(100);
	starting.setMinHeight(100);
	return starting;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:10,代码来源:LevelManager.java

示例7: setStopBtn

import javafx.scene.control.Button; //导入方法依赖的package包/类
public void setStopBtn() {
    Button stopBtn = this.stopBtn;
    stopBtn.setLayoutX(150);
    stopBtn.setLayoutY(250);
    this.getChildren().add(stopBtn);
}
 
开发者ID:KosOrfan,项目名称:javafx-beginner,代码行数:7,代码来源:AnimSide.java

示例8: setPlayBtn

import javafx.scene.control.Button; //导入方法依赖的package包/类
public void setPlayBtn() {
    Button playBtn = this.playBtn;
    playBtn.setLayoutX(250);
    playBtn.setLayoutY(250);
    this.getChildren().add(playBtn);
}
 
开发者ID:KosOrfan,项目名称:javafx-beginner,代码行数:7,代码来源:AnimSide.java

示例9: setBtn

import javafx.scene.control.Button; //导入方法依赖的package包/类
public void setBtn() {
    Button btn = this.btn;
    btn.setLayoutX(250);
    btn.setLayoutY(10);
    btn.setPrefHeight(20);
}
 
开发者ID:KosOrfan,项目名称:javafx-beginner,代码行数:7,代码来源:WebViewSide.java


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