Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8128310

ClassCastException from impl_cssSet when trying to style prefColumns or prefRows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • fx2.0.2
    • 7-pool
    • javafx

      WARNING: javafx.scene.Node impl_cssSet Failed to set css [StyleableProperty {owningClass: javafx.scene.layout.TilePane, fieldName: prefColumns, property: -fx-pref-columns, converter: SizeConverter, initialValue: '5', inherits: false, subProperties: []}]

      java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
              at javafx.scene.layout.TilePane.impl_cssSet(TilePane.java:930)


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.TilePane;
      import javafx.stage.Stage;

      public class Main extends Application {

          public static void main(String[] args) {
              Application.launch(args);
          }

          @Override public void start(Stage stage) throws Exception {

              TilePane tilePane = new TilePane();
              tilePane.setStyle("-fx-pref-columns: 3; -fx-pref-rows: 2;");

              Button btns[] = new Button[6];
              for (int i=0; i<6; i++) {
                  btns[i] = new Button(Integer.toString(i));
                  btns[i].setStyle("-fx-padding: 20;");
                  tilePane.getChildren().add(btns[i]);
              }

              stage.setScene(new Scene(tilePane));
              stage.show();
          }
      }

            dgrieve David Grieve
            dgrieve David Grieve
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: