Java Code Examples for javafx.scene.control.Button#setLayoutY()

The following examples show how to use javafx.scene.control.Button#setLayoutY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModalDialogDemo.java    From oim-fx with MIT License 6 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    primaryStage.setTitle("Hello World");
    ModalDialog md = new ModalDialog(primaryStage);
    
    Group root = new Group();
    Scene scene = new Scene(root, 500, 450, Color.LIGHTBLUE);
    Button btn = new Button();
    btn.setLayoutX(250);
    btn.setLayoutY(240);
    btn.setText("Show modal dialog");
    btn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
        	md.show();
        }
    });
    root.getChildren().add(btn);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 2
Source File: ShowAccountDialogTest.java    From oim-fx with MIT License 6 votes vote down vote up
@Override
  public void start(final Stage primaryStage) {
      primaryStage.setTitle("Hello World");
ShowAccountDialog md = new ShowAccountDialog(primaryStage);
      
      Group root = new Group();
      Scene scene = new Scene(root, 500, 450, Color.LIGHTBLUE);
      Button btn = new Button();
      btn.setLayoutX(250);
      btn.setLayoutY(240);
      btn.setText("Show modal dialog");
      btn.setOnAction(new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
          	md.show();
          }
      });
      root.getChildren().add(btn);
      primaryStage.setScene(scene);
      primaryStage.show();
  }
 
Example 3
Source File: TodaysDateWiget.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Hello World");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
    Button btn = new Button();
    btn.setLayoutX(100);
    btn.setLayoutY(80);
    btn.setText("Hello World");
    btn.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            Stage st = new Stage(StageStyle.UNDECORATED);
            Group group = new Group();
            Scene s = new Scene(group ,WIDTH+3,HEIGHT+5);
            s.setFill(null);
            group.getChildren().addAll(getToDayControl());
            st.setScene(s);
            st.show();
 
        }
    });
    btn.fire();
    root.getChildren().add(btn);
    primaryStage.setScene(scene);
    //primaryStage.setVisible(false);
    primaryStage.close();
}
 
Example 4
Source File: LedView.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * Creates a new instance of Node
 * @param simulator the arm simulator
 */
public LedView(ArmSimulator simulator){

    this.simulator = simulator;

    this.mainPane = new ScrollPane();
    
    ledOff = new Image(getClass().getResource("/resources/ledOff.png").toExternalForm());
    ledOn = new Image(getClass().getResource("/resources/ledOn.png").toExternalForm());
    leverOff = new Image(getClass().getResource("/resources/leverOff.png").toExternalForm());
    leverOn = new Image(getClass().getResource("/resources/leverOn.png").toExternalForm()); 
      
    gameContainer = new HBox();
    ledContainer = new VBox();
    buttonContainer = new VBox();
            
    for(int i=0 ; i < 8 ; i++) { //creating 8 leds at the start of the view
    	IOLed led = simulator.newIOLed();
    	
    	AnchorPane newLedAddress = new AnchorPane();
        ImageView newLedImage = new ImageView();
        
        ledArray.add(led);
    	ledImageArrayList.add(newLedImage);
    	
    	if(led.isOn()) {
        	newLedImage.setImage(ledOn);
        }else {
        	newLedImage.setImage(ledOff);
        }       	

        newLedImage.setLayoutX(0);
        newLedImage.setLayoutY(0);
        Text newAddress = new Text();
        newAddress.setText("0x" + Long.toHexString(led.getPortAddress()) + " Bit N°" + led.shift);
        newAddress.setLayoutX(95);
        newAddress.setLayoutY(55);
        
        newLedAddress.getChildren().addAll(newLedImage, newAddress);
        ledContainer.getChildren().add(newLedAddress);
    }
    
    for(int i=0 ; i < 2 ; i++) { //creating 3 buttons at the start of the view
    	IOButton IOpressButton = simulator.newIOButton();
    	IOSwitch IOleverButton = simulator.newIOSwitch();
    	AnchorPane buttonAndTextAndLeverAndTextAnchorPane = new AnchorPane();
    	       	
    	Text leverText = new Text();
    	leverText.setText("0x" + Long.toHexString(IOpressButton.getPortAddress()) + " Bit N°" + IOpressButton.shift);
    	leverText.setLayoutX(30);
        leverText.setLayoutY(100);

        Text pushingText = new Text();
        pushingText.setText("0x" + Long.toHexString(IOleverButton.getPortAddress()) + " Bit N°" + IOleverButton.shift);
        pushingText.setLayoutX(30);
        pushingText.setLayoutY(190);
        
        ImageView lever = new ImageView(leverOff);            
    	Button leverButton =  new Button("", lever);
    	Button pushingButton = new Button("", new ImageView(new Image(getClass().getResource("/resources/pushingButton.png").toExternalForm())));

    	leverButton.setOnAction(ActionEvent -> {
    		IOleverButton.flip();       
    		refresh();
        });
    	
    	pushingButton.setOnAction(ActionEvent -> {
    		IOpressButton.push();     
    		refresh();
        });


    	leverButton.setLayoutX(70);
        leverButton.setLayoutY(25);
    	pushingButton.setLayoutX(70);
        pushingButton.setLayoutY(115);        
        
    	leverButtonArray.add(IOleverButton);
    	pressButtonArray.add(IOpressButton);
    	leverImageArrayList.add(lever);
    	
    	buttonAndTextAndLeverAndTextAnchorPane.getChildren().addAll(leverButton, leverText, pushingButton, pushingText);
    	buttonContainer.getChildren().add(buttonAndTextAndLeverAndTextAnchorPane);
    }
    
    gameContainer.getChildren().addAll(ledContainer, buttonContainer);
    
    this.dockNode = new DockNode(mainPane, "Led Game", new ImageView(dockImage));
    
    dockNode.setPrefSize(300,666);
    
    this.mainPane.setContent(gameContainer);  
    this.mainPane.setFitToWidth(true);
    this.mainPane.setFitToHeight(true);  
    this.mainPane.setHmin(dockNode.getHeight());
}