java - Setting a DatePicker's height -


How can I determine the height of a DatePicker ?

Normally, you will set prefHyight or maxHyight as you would with a button or label but this is the DatePicker Is not working with.

  Date picture date picture = new date picture (); Add pane.getChildren () (datepicker) .; DatePicker.setMaxHeight (16);   

Note, I am only interested in the height of "Input Field" popup calendar is fine.

scaley set the functions of the property, but of course all things are destroyed ...

I think you set the setPrefHeight () method to set your preferred height for DatePicker the wanted.

example

Here are some example codes: import javafx.application.Application; Import static javafx.application.Application.launch; Import javafx.scene.Scene; Import javafx.scene.control.DatePicker; Import javafx.scene.control.Label; Import javafx.scene.layout.AnchorPane; Import javafx.scene.layout.HBox; Import javafx.scene.layout.vbox; Import javafx.stage.Stage; The public class expands the main app app {@ Override throws an exception to the public-wide start (stage stage) {anchpay root = new anchorpan (); Date picture date picture = new date picture (); DatePicker.setMinHeight (12.); DatePicker.setPrefHeight (16); DatePicker.setMaxHeight (60.); HBOOX = new HBOX (); HBox.getChildren (). Add (new label ("60px height with DatePicker")); Add hBox.getChildren () (datepicker) .; Hbox HBbox 1 = new HBOox (); Date picture date Picture 1 = New date picture (); HBox1.getChildren () Add (New Label ("DatePicker with Default Height")); Add hBox1.getChildren () (datePicker1) .; VBox vBox = new VBox (25); VBox.getChildren (). AddAll (hBox, hBox1); Add root.getChildren () (vbox) .; Visual View = New View (Route); Stage.setTitle ("JavaFXs' DatePicker and setPrefHeigth () method"); Stage.setScene (view); stage show(); } Public static zero main (string [] args) {launch (args);

With setMaxHeight () method, you can override the maximum calculated area, you can read in

: Update :

Use the setMinHeight () method to set the minimum height on your DatePicker (Use the value that your preferred height is low ) And then you can also use 16 as your favorite height

setMinHeight ( ) With the picture 2

code snippet

<>> Date picture date picture = new date picture (); DatePicker.setMinHeight (12.); DatePicker.setPrefHeight (16); HBOOX = new HBOX (); HBox.getChildren (). Add (new label ("16px height with DatePicker")); Add hBox.getChildren () (datepicker) .;

Patrick

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -