javafx-8

Set divider position of SplitPane

不想你离开。 提交于 2019-12-08 20:56:34
问题 I want to set the divider of a SplitPane to a certain default position. This does not work, the divider stays in the middle: public void start(Stage primaryStage) throws Exception{ SplitPane splitPane = new SplitPane(new Pane(), new Pane()); // Report changes to the divider position splitPane.getDividers().get(0).positionProperty().addListener( o -> System.out.println(splitPane.getDividerPositions()[0]) ); // Doesn't work: splitPane.setDividerPositions(0.8); // The docs seem to recommend the

Spinner<Integer> bind to IntegerProperty

六月ゝ 毕业季﹏ 提交于 2019-12-08 19:34:12
问题 I want to use a FX8 Spinner control, but I want to bind the source to an IntegerProperty int MIN = 0; int MAX = 5000; int STEP = 500; IntegerProperty integerProperty = new SimpleIntegerProperty(); Spinner<Integer> spinner = new Spinner<>(MIN, MAX, STEP); I understand the binding is set via binding to the valueProperty in the Value Factory. However this expects Property<Integer> and I cannot find a way to cast between IntegerProperty and Property<Integer> . Obviously the below generates a

JavaFX Make object visible but not consume (ignore) clicks

心已入冬 提交于 2019-12-08 19:10:52
问题 Title says it all: I have a rectangle in JavaFX (for transparency/opacity effects) yet I want people to be able to 'click through' it. So when I say click through, I mean when you click it, Java should pretend it isn't there and instead 'click' on whatever is beneath that object. When you make something invisible with setVisible(false), this is exactly what happens - whatever object you set invisible doesn't consume the click events that your mouse generates. However, the object becomes

How to set Minimum and maximum date in Datepicker Calander in JavaFx8?

雨燕双飞 提交于 2019-12-08 16:47:48
Please help. How Can we set min and max date in date picker calendar in javafx8? Johan Kaewberg Or why not minDate = LocalDate.of(1989, 4, 16); maxDate = LocalDate.now(); datePicker.setDayCellFactory(d -> new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); setDisable(item.isAfter(maxDate) || item.isBefore(minDate)); }}); No need to create an extra datepicker just to store the max date. It is possible to limit the dates available for being selected by user by disabling those days on a dayCellFactory and setting those dates range to

Pick and move a node in a pannable/zoomable Pane

帅比萌擦擦* 提交于 2019-12-08 16:10:04
问题 I am trying to place a few components inside a ScrollPane . These components should have the ability to be moved across this pane by mouse (click and drag). The ScrollPane itself is pannable and zoomable. Now if I pick one of them and drag it to a new position the mouse is faster than the component if I have zoomed out. When zoomed in, the component gets moved faster than the mouse movement. If not zoomed it works until I reach a certain position where the ScrollPane automatically pans. It

How can i force cursor to stay in place on window when dragging an Undecorated Stage

你离开我真会死。 提交于 2019-12-08 15:02:32
问题 I'm trying to create gui calculator with an undecorated stage. I added an Hbox as the title bar and set gave it an onClicked/OnDragged methods to move the primary stage around when dragged, however it doesn't seem to work perfectly. because 1) When i press and start dragging, the mouse cursor moves to the top left corner of the window as you can see below. The method i used is from here X IMAGES: When i click on middle of Hbox Where the cursor moves when i start dragging X Here is my main

How to make JavaFX Slider to move in discrete steps?

青春壹個敷衍的年華 提交于 2019-12-08 14:58:07
问题 I am making a GUI using JavaFx and I need sliders that only allow integers to ever be selected. I know I can use snapToTicks , but while pulling the "knob" , it can still represent a non-integer value. I would like to get rid of that. It messes up other components linked to it. Basically, I want something like Swing's JSlider , but with JavaFx . Is it possible? I have been searching but I can't find anything. 回答1: You can simply add a listener to the valueProperty of the Slider and then you

How to handle correlated FX properties?

笑着哭i 提交于 2019-12-08 14:00:34
问题 Properties - ol' style bean properties just the same as blinky fx properties - work best if they are orthogonal to each other. They pose problems - again, both types - if they are somehow correlated. Which might happen in nasty Real World more often than we like. As an example take the twosome selectedIndex/selectedItem: the index points to the position of the item in a list if it is contained, or is negative if not. Updating one requires to update the other as well. For java beans, the

JavaFX ListCell enable horizontal Growth

青春壹個敷衍的年華 提交于 2019-12-08 13:48:24
问题 I currently have a ListView that is resizable in Width and I use a custom CellFactory that returns my custom ListCell objects. I already read this: Customize ListView in JavaFX with FXML and I use a similar construct like the one mentioned: public class ListViewCell extends ListCell<String>{ @Override public void updateItem(String string, boolean empty){ super.updateItem(string,empty); if(string != null) { ... setGraphic(myComponent); } } I want myComponent to take the full size that is

JavaFX ObservableList toTableview via Task Thread

北城余情 提交于 2019-12-08 13:11:37
问题 I am building a multiscreen JavaFX app with data being pulled from a SQL database to ObservableLists and displayed in the interface via Tableview. Because of the multiscreen nature of the app, I am trying to initialize the data from the ObservableList to the Tableview via the controller. The SQL pull to ObservableList is done via a Task on a new thread. When I include the sqlCSEditTbl.itemsProperty().setValue((ObservableList) csSQLList) in the Task method nothing is displayed in the TableView