Source of NodeStyleRotateDemo.java


  1: 
  2: import javafx.application.Application;
  3: import javafx.scene.Scene;
  4: import javafx.scene.control.Button;
  5: import javafx.stage.Stage;
  6: import javafx.scene.layout.StackPane;
  7: 
  8: public class NodeStyleRotateDemo extends Application {
  9:   @Override // Override the start method in the Application class
 10:   public void start(Stage primaryStage) {
 11:     // Create a scene and place a button in the scene
 12:     StackPane pane = new StackPane();
 13:     Button btOK = new Button("OK");
 14:     btOK.setStyle("-fx-border-color: blue;");
 15:     pane.getChildren().add(btOK);
 16: 
 17:     pane.setRotate(45);
 18:     pane.setStyle(
 19:       "-fx-border-color: red; -fx-background-color: lightgray;");
 20: 
 21:     Scene scene = new Scene(pane, 200, 250);
 22:     primaryStage.setTitle("NodeStyleRotateDemo"); // Set the stage title
 23:     primaryStage.setScene(scene); // Place the scene in the stage
 24:     primaryStage.show(); // Display the stage
 25:   }
 26: 
 27:   /**
 28:    * The main method is only needed for the IDE with limited
 29:    * JavaFX support. Not needed for running from the command line.
 30:    */
 31:   public static void main(String[] args) {
 32:     launch(args);
 33:   }
 34: }