Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8144924 | 8u92 | Jonathan Giles | P3 | Resolved | Fixed |
When using a custom button skin together with the DatePicker's calendar button one get's multiple NullPointerExceptions. SSCCE bellow.
REC76.java:
package rec.pkg76;
import java.net.URL;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class REC76 extends Application {
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
DatePicker datePicker = new DatePicker();
root.getChildren().add(datePicker);
Scene scene = new Scene(root, 300, 250);
URL styleSheet = REC76.class.getResource("stylesheet.css");
scene.getStylesheets().add(styleSheet.toExternalForm());
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
ButtonSkin.java:
package rec.pkg76;
import javafx.scene.control.Button;
public class ButtonSkin extends com.sun.javafx.scene.control.skin.ButtonSkin {
public ButtonSkin(Button button) {
super(button);
// NullPointerExecption even if the button skin doesn't do anything
}
}
stylesheet.css:
.button {
-fx-skin: "rec.pkg76.ButtonSkin";
}
REC76.java:
package rec.pkg76;
import java.net.URL;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class REC76 extends Application {
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
DatePicker datePicker = new DatePicker();
root.getChildren().add(datePicker);
Scene scene = new Scene(root, 300, 250);
URL styleSheet = REC76.class.getResource("stylesheet.css");
scene.getStylesheets().add(styleSheet.toExternalForm());
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
ButtonSkin.java:
package rec.pkg76;
import javafx.scene.control.Button;
public class ButtonSkin extends com.sun.javafx.scene.control.skin.ButtonSkin {
public ButtonSkin(Button button) {
super(button);
// NullPointerExecption even if the button skin doesn't do anything
}
}
stylesheet.css:
.button {
-fx-skin: "rec.pkg76.ButtonSkin";
}
- backported by
-
JDK-8144924 NullPointerException in DatePicker when a custom ButtonSkin is set
-
- Resolved
-