Package javafx.geometry

Examples of javafx.geometry.Insets


  {
    VBox lVBox = new VBox(5.0);
    lVBox.add(new Button("short"), new VBox.C().vgrow(Priority.ALWAYS));
    lVBox.add(new Button("medium length"), new VBox.C().vgrow(Priority.ALWAYS));
    lVBox.add(new Button("a longer description in order to test things"), new VBox.C().vgrow(Priority.ALWAYS));
    lVBox.add(new Button("margin 5 grow"), new VBox.C().margin(new Insets(5.0)).vgrow(Priority.ALWAYS));
    lVBox.getChildren().add(new Button("old style"));
    lVBox.add(new Button("margin 20 nogrow"), new VBox.C().margin(new Insets(20.0)));
    lVBox.add(new Button("grow maxwidth 150"), new VBox.C().vgrow(Priority.ALWAYS).maxWidth(150.0));
       
        // setup scene
    Scene scene = new Scene(lVBox, 300, 400);
   
View Full Code Here


  @Override
  public void start(Stage stage)
  {
    HBox lHBox = new HBox(5.0);
    lHBox.add(new Button("grow"), new HBox.C().hgrow(Priority.ALWAYS));
    lHBox.add(new Button("margin 5 grow"), new HBox.C().margin(new Insets(5.0)).hgrow(Priority.ALWAYS));
    lHBox.getChildren().add(new Button("old style"));
    lHBox.add(new Button("margin 20 nogrow"), new HBox.C().margin(new Insets(20.0)));
    lHBox.add(new Button("grow maxheight 50"), new HBox.C().hgrow(Priority.ALWAYS).maxHeight(50.0));

        // setup scene
    Scene scene = new Scene(lHBox, 800, 200);
   
View Full Code Here

  public void start(Stage stage)
  {
    GridPane gridPane = new GridPane()
      .withHGap(5)
      .withVGap(5)
      .withPadding(new Insets(10, 10, 10, 10))
      .withGridLinesVisible(true);

      gridPane.add(new Label("SingleCell"), new GridPane.C().col(1).row(0));
    gridPane.add(new Label("RIGHT"), new GridPane.C().col(2).row(0).halignment(HPos.RIGHT));
View Full Code Here

   */
  public Parent getRootNode()
  {
    hbox = new HBox(5.0);
    hbox.add(new Button("grow"), new HBox.C().hgrow(Priority.ALWAYS));
    hbox.add(new Button("margin 5 grow"), new HBox.C().margin(new Insets(5.0)).hgrow(Priority.ALWAYS));
    hbox.getChildren().add(new Button("old style"));
    hbox.add(new Button("margin 20 nogrow"), new HBox.C().margin(new Insets(20.0)));
    hbox.add(new Button("grow maxheight 50"), new HBox.C().hgrow(Priority.ALWAYS).maxHeight(50.0));

    return hbox;
  }
View Full Code Here

  {
    vbox = new VBox(5.0);
    vbox.add(new Button("short"), new VBox.C().vgrow(Priority.ALWAYS));
    vbox.add(new Button("medium length"), new VBox.C().vgrow(Priority.ALWAYS));
    vbox.add(new Button("a longer description in order to test things"), new VBox.C().vgrow(Priority.ALWAYS));
    vbox.add(new Button("margin 5 grow"), new VBox.C().margin(new Insets(5.0)).vgrow(Priority.ALWAYS));
    vbox.getChildren().add(new Button("old style"));
    vbox.add(new Button("margin 20 nogrow"), new VBox.C().margin(new Insets(20.0)));
    vbox.add(new Button("grow maxwidth 150"), new VBox.C().vgrow(Priority.ALWAYS).maxWidth(150.0));

    return vbox;
  }
View Full Code Here

    HBox lHBox = new HBox();
   
    {
      GridPane lGridPane = new GridPane();
      lGridPane.setVgap(5.0);
      lGridPane.setPadding(new Insets(5.0));
      int lRowIdx = 0;
     
      {
        lGridPane.add(new Label("Empty list"), 0, lRowIdx);
        ListSpinner<String> lSpinner = new ListSpinner<String>();
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Cyclic list"), 0, lRowIdx);
        ListSpinner<String> lSpinner = new ListSpinner<String>("a", "b", "c")
          .withCyclic(true)
          ;
        lGridPane.add(lSpinner, 1, lRowIdx);
       
        final TextField lValueTextField = new TextField();
        lValueTextField.textProperty().bind(lSpinner.valueProperty());
        lGridPane.add(lValueTextField, 2, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Cyclic list with null"), 0, lRowIdx);
        ListSpinner<String> lSpinner = new ListSpinner<String>( "a", "b", "c", null )
          .withCyclic(true)
          ;
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Editable cyclic list"), 0, lRowIdx);
        ListSpinner<String> lSpinner = new ListSpinner<String>( "a", "b", "c", "d", "e" )
          .withCyclic(true)
          .withEditable(true)
          .withStringConverter(StringConverterFactory.forString())
          ;
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Editable and adding cyclic list"), 0, lRowIdx);
        final ObservableList<String> lObservableList = FXCollections.observableArrayList("a", "b", "c", "d", "e");
        ListSpinner<String> lSpinner = new ListSpinner<String>( lObservableList )
          .withCyclic(true)
          .withEditable(true)
          .withStringConverter(StringConverterFactory.forString())
          .withAddCallback(new Callback<String, Integer>()
          {         
            @Override
            public Integer call(String text)
            {
              lObservableList.add(text);
              return lObservableList.size() - 1; // notify spinner the value is appended at the end
            }
          })
          ;
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Observable list, 'z' prepended"), 0, lRowIdx);
        final ObservableList<String> lObservableList = FXCollections.observableArrayList("a", "b", "c", "d", "e");
        ListSpinner<String> lSpinner = new ListSpinner<String>( lObservableList );
        lObservableList.add(0, "z");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Observable list, first removed"), 0, lRowIdx);
        final ObservableList<String> lObservableList = FXCollections.observableArrayList("a", "b", "c", "d", "e");
        ListSpinner<String> lSpinner = new ListSpinner<String>( lObservableList );
        lObservableList.remove("a");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
//      {
//        lGridPane.add(new Label("Observable list, emptied"), 0, lRowIdx);
//        final ObservableList<String> lObservableList = FXCollections.observableArrayList("a", "b", "c", "d", "e");
//        ListSpinner<String> lSpinner = new ListSpinner<String>( lObservableList );
//        lObservableList.clear(); // TODO: causes exception
//        lGridPane.add(lSpinner, 1, lRowIdx++);
//      }
      {
        lGridPane.add(new Label("BigInteger range"), 0, lRowIdx);
        ListSpinner<BigInteger> lSpinner = new ListSpinner<BigInteger>(new ListSpinnerBigIntegerList(BigInteger.valueOf(Long.MIN_VALUE), BigInteger.valueOf(Long.MIN_VALUE + 1000)));
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(new ListSpinnerIntegerList());
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range 10..110"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(10, 110);
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range 10..110 with setIndex 50"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(10, 110);
        lSpinner.setIndex(50);
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range 0..1000 step 10"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(0, 100, 10);
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range -10..10"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(-10, 10);
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range 10..-10"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(10, -10);
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("align right"), 0, lRowIdx);
        ListSpinner<String> lSpinner = new ListSpinner<String>( "a", "b", "c", "d", "e" );
        lSpinner.setStyle("-fxx-value-alignment:CENTER_RIGHT;");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("align right"), 0, lRowIdx);
        ListSpinner<String> lSpinner = new ListSpinner<String>( "a", "b", "c", "d", "e" )
          .withEditable(true)
          .withStringConverter(StringConverterFactory.forString())
          ;
        lSpinner.setStyle("-fxx-value-alignment:CENTER_RIGHT;");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range 0..100 with %"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(0, 100)
            .withPostfix("%")
            ;
        lSpinner.setStyle("-fxx-value-alignment:CENTER_RIGHT;");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer range 0..100 with %"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(0, 100)
            .withPostfix("%")
            .withEditable(true)
            .withStringConverter(StringConverterFactory.forInteger())
            ;
        lSpinner.setStyle("-fxx-value-alignment:CENTER_RIGHT;");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer currency 0..100"), 0, lRowIdx);
        ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(0, 100)
            .withPrefix("$ ")
            ;
        lSpinner.setStyle("-fxx-value-alignment:CENTER_RIGHT;");
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
      {
        lGridPane.add(new Label("Integer currency 0..100"), 0, lRowIdx);
        final ListSpinner<Integer> lSpinner = new ListSpinner<Integer>(0, 100)
            .withPrefix("$ ")
            .withEditable(true)
            .withStringConverter(StringConverterFactory.forInteger())
            ;
        lSpinner.setStyle("-fxx-value-alignment:CENTER_RIGHT;");
       
        Button lButton = new Button("change CSS");
        lButton.onMouseClickedProperty().set(new EventHandler<MouseEvent>()
        {
          @Override
          public void handle(MouseEvent arg0)
          {
            //lSpinner.setStyle("-fxx-arrow-position:SPLIT;");
            //lSpinner.setStyle("-fxx-arrow-direction:VERTICAL;;");
            lSpinner.setStyle("-fxx-value-alignment:CENTER_LEFT; -fxx-arrow-direction:VERTICAL; -fxx-arrow-position:SPLIT;");
          }
        });
        lGridPane.add(lButton, 2, lRowIdx);
       
        lGridPane.add(lSpinner, 1, lRowIdx++);
      }
     
      lHBox.getChildren().add(lGridPane);
    }
   
    {
      GridPane lGridPane = new GridPane();
      lGridPane.setVgap(5.0);
      lGridPane.setPadding(new Insets(5.0));
      int lRowIdx = 0;

      // arrow position
      {
        lGridPane.add(new Label("DEFAULT"), 0, lRowIdx);
View Full Code Here

        });
    }

    @Override public void start(Stage stage) {
        StackPane pane = new StackPane();
        pane.setPadding(new Insets(5, 5, 5, 5));
        pane.getChildren().addAll(clock);

        Scene scene = new Scene(pane);
        //scene.setFullScreen(true);
View Full Code Here

        chart.setSeries(series);
    }

    @Override public void start(Stage stage) throws Exception {
        StackPane pane = new StackPane();
        pane.setPadding(new Insets(5, 5, 5, 5));
        pane.getChildren().addAll(chart);

        Scene scene = new Scene(pane);
        //scene.setFullScreen(true);
View Full Code Here

        iconSwitchSymbol1.setOnSelect(switchEvent -> System.out.println("Icon Switch Symbol 1 switched on"));
    }

    @Override public void start(Stage stage) {
        VBox pane = new VBox();
        pane.setPadding(new Insets(10, 10, 10, 10));
        pane.setBackground(new Background(new BackgroundFill(Color.web("#34495e"), CornerRadii.EMPTY, Insets.EMPTY)));
        pane.setSpacing(20);
        pane.setAlignment(Pos.CENTER);
        pane.getChildren().addAll(onOffSwitch, iconSwitchSymbol, iconSwitchText, iconSwitchSymbol1);
View Full Code Here

        };
    }

    @Override public void start(Stage stage) {
        StackPane pane = new StackPane();
        pane.setPadding(new Insets(5, 5, 5, 5));
        pane.setBackground(new Background(new BackgroundFill(Color.rgb(70, 70, 70), CornerRadii.EMPTY, Insets.EMPTY)));
        pane.getChildren().setAll(signalTower);

        Scene scene = new Scene(pane);
View Full Code Here

TOP

Related Classes of javafx.geometry.Insets

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.