Created
March 2, 2016 09:14
-
-
Save bugabinga/ba58d5adffa1324e727e to your computer and use it in GitHub Desktop.
How to show the UI of a DatePicker constantly. http://stackoverflow.com/questions/35650600/how-to-disable-hiding-of-combobox-popup-in-javafx8 , http://stackoverflow.com/questions/35721273/always-visible-datepicker-from-javafx .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javafx.application.Application; | |
| import javafx.scene.Scene; | |
| import javafx.scene.control.DatePicker; | |
| import javafx.scene.layout.StackPane; | |
| import javafx.stage.Stage; | |
| /** | |
| * How to show the UI of a DatePicker constantly. | |
| * | |
| * http://stackoverflow.com/questions/35650600/how-to-disable-hiding-of-combobox-popup-in-javafx8 | |
| * | |
| * http://stackoverflow.com/questions/35721273/always-visible-datepicker-from-javafx | |
| * | |
| * @author okr | |
| * @date 02.03.2016 | |
| * | |
| */ | |
| public class ConstantDatePicker extends Application | |
| { | |
| @Override | |
| public void start( final Stage primaryStage ) | |
| { | |
| final DatePicker datePicker = new DatePicker(); | |
| final StackPane root = new StackPane( datePicker ); | |
| final Scene scene = new Scene( root, 250, 200 ); | |
| primaryStage.setScene( scene ); | |
| primaryStage.show(); | |
| datePicker.setVisible( false ); | |
| datePicker.setManaged( false ); | |
| final com.sun.javafx.scene.control.skin.DatePickerSkin skin = (com.sun.javafx.scene.control.skin.DatePickerSkin) datePicker.getSkin(); | |
| root.getChildren().add( skin.getPopupContent() ); | |
| } | |
| /** | |
| * @param args ignored. | |
| */ | |
| public static void main( final String[] args ) | |
| { | |
| launch( args ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment