javafx-8

JavaFx: How to compare values of dynamically created TextFields inside GridPane?

冷暖自知 提交于 2019-12-01 07:24:16
问题 I'm developing an application using JavaFx in which I'm creating dynamic TextFields inside a GridPane and there is a Button which is initially disabled like this: So what I want is if Column 1 TextFields values are less than Column 3 TextFields values, button should be enable like this: But let say if any of Column 3 TextField value become less than Column 1 TextField value of same row, it should disable button and show that specific TextField border in red color and when hover mouse over

How to resize component with mouse drag in JavaFX

纵然是瞬间 提交于 2019-12-01 07:15:39
问题 I'm interested how I can resize this component with mouse drag: VBox stackedTitledPanes = createStackedTitledPanes(); ScrollPane scroll = makeScrollable(stackedTitledPanes); TabPane tabPane = new TabPane(); BorderPane mainPane = new BorderPane(); tabPane.setStyle("-fx-font-size: 12pt;"); // Set global size for the font // Create Tabs Tab tabA = new Tab(); tabA.setText("Main Component"); tabA.setStyle("-fx-font-size: 12pt;"); // Set size of the tab name // Add something in Tab StackPane tabA

Dragging and dropping list view items between different javafx windows

夙愿已清 提交于 2019-12-01 07:09:27
问题 I've been wondering how you would be able to drag and drop list view items between 2 java fx windows. The code that I used was tilePane.setOnDragDropped((event) -> { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasString()) { TilePane pane = (TilePane) event.getGestureTarget(); if (pane.getChildren().size() >= 10) { //error } else { ListView<Item> list = (ListView<Item>) event .getGestureSource(); addShopItem(pane, list.getSelectionModel() .getSelectedItem()); success

JavaFX 8 - Add a graphic to a TitledPane on the right side

左心房为你撑大大i 提交于 2019-12-01 06:51:57
I want to add a little icon to the title of a TitledPane . Therefore I set an empty title and add a HBox containing a Label and a ImageView as graphic. In this way the icon is shown close to the end of the text. I want it to be shown always next to the right border of the TitledPane . How can I do this? I also tried to use a BorderPane and add the Label to the center and the ImageView to the right, but the BorderPane doesn't get the maximum size of the TitledPane. So I tried to set MaxWidth to Max-Value, but this didn't help Does anybody know what to do? **EDIT: ** The "custom" control I

Wait for Platform.RunLater in a unit test

佐手、 提交于 2019-12-01 06:34:09
I have a presentation class storing an XYChart.Series object and updating it by observing the model. The Series updating is done by using Platform.runLater(...) I want to unit-test this, making sure the commands in runLater are performed correctly. How do I tell the unit-test to wait for the runLater commands to be done? Right now all I do is Thread.Sleep(...) on the test-thread to give the FXApplicationThread the time to complete, but that sounds stupid. The way I solved it is as follows. 1) Create a simple semaphore function like this: public static void waitForRunLater() throws

Selecting a period or a date using ONE JavaFX 8 DatePicker

筅森魡賤 提交于 2019-12-01 05:59:28
On the application I am currently working, it is necessary to select a single date or a period from the same JavaFX 8 DatePicker. The preferred way of doing this would be as follows: Selecting a single date - same as default behaviour of the DatePicker. Selecting a period - select start/end date by holding down the mouse button and drag to the desired end/start date. When the mouse button is released you have defined your period. The fact that you cannot select dates other than those displayed is acceptable. Editing should work for both single date (ex 24.12.2014) and period ( ex: 24.12.2014 -

Java 8 DatePicker and editable ComboBox behavior change between 8u51 and 8u60

我只是一个虾纸丫 提交于 2019-12-01 05:46:30
问题 We have searched this forum and the web extensively and have not found anything related to this issue so I felt compelled to post this question here... We have observed a major behavioral change with regard to the functionality of both the JavaFX8 DatePicker and editable ComboBox elements between the release of Java 8 u51 and u60. Running under u51 you could enter a date such as 12/30/1970 in a DatePicker and tab to the next U.I. element and the data would automatically be saved and if the

JavaFX SceneBuilder 2.0 doesn't open FXML for custom components with fx:root as main layout tag

£可爱£侵袭症+ 提交于 2019-12-01 05:10:26
I have custom component with layout on FXML file which containts line <fx:root type="javafx.scene.layout.VBox" spacing="10.0" xmlns:fx="http://javafx.com/fxml"> I create this file on SceneBuilder 1.0, but then i try open this file on SceneBuilder 2.0 i got Exception java.io.IOException: javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load. /Users/dmitrynelepov/Development/SogazGit/smpb/SMProjectBrownRelease/SMPBProxy/engine/fxml/component_daemon_viewer.fxml:14 Also must to tell: in applications this fxml loadings fine with setting root by code. In official tutorial

How does FXMLLoader load the FXML's controller?

血红的双手。 提交于 2019-12-01 04:17:37
What happens when I call FXMLLoader#load() in JavaFX? Suppose the FXML controller extends a class that has a constructor. Will there be assurance that the constructor will be called? And if not, how will a new instance of the object be created? For example, in the code below, will the TextField() constructor be called? import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.Initializable; import javafx.scene.control.TextField; public class FXMLController extends TextField implements Initializable { @Override public void initialize(URL url, ResourceBundle rb) { } } I already

How to convert an observableset to an observablelist

早过忘川 提交于 2019-12-01 04:06:52
I am trying to set items to a tableview but the setitems method expects an observablelist while I have an observableset in my model.The FXCollections utility class does not have a method for creating an observable list given an observable set.I tried casting but that caused a class cast exception (as expected). Currently I am using this kind of code new ObservableListWrapper<E>(new ArrayList<E>(pojo.getObservableSet())); And I have some problems with it: Will editing this in the table update the underlying set as expected? Is it the 'right' way of doing this So in short I need a style guide or