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

[CSS] WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u20
    • javafx
    • None

      The following app produces the following warning, when using the Menu:

      (tested with 8u20 b13)

      WARNING: Caught 'java.lang.ClassCastException: javafx.scene.paint.LinearGradient cannot be cast to javafx.scene.paint.Color' while converting value for '-fx-text-fill' from rule '*.menu-bar>*.container>*.menu-button:hover>*.label' in stylesheet jar:file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_20/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss


      Nonetheless, the blue-red gradient works as expected.


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.stage.Stage;

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

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

              MenuBar menuBar = new MenuBar();
              Menu menu1 = new Menu("Menu");
              menu1.getItems().add(new MenuItem("Test"));

              menuBar.getMenus().add(menu1);

              Scene scene = new Scene(menuBar);
              scene.getStylesheets().add("styles.css");
              stage.setScene(scene);
              stage.show();
          }
      }

      styles.css:

      .root {
          -fx-selection-bar: linear-gradient(to top, derive(red, -2%) 0%, derive(blue, 50%) 100%);
      }

            Unassigned Unassigned
            cschudtjfx Christian Schudt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported: