javafx-8

Javafx Datepicker validation

故事扮演 提交于 2019-12-07 04:07:25
问题 we tried to validate a javafx datepicker. So we use: if (fromDatePicker.getValue() == null) { sb.append("No valid from date!\n"); } else { System.out.println(fromDatePicker.getValue().toString()); if (!DateUtil .validEnglishDate(fromDatePicker.getValue().toString())) { sb.append("No valid from date. Use the format yyyy-MM-dd.\n"); } } But at the moment it's impossible to get an invalid Date with the datepicker, because all invalid date's are changed to the start value. So we asked us is it

Limiting character count of JavaFX TextField causes IndexOutOfBounds on Undo

被刻印的时光 ゝ 提交于 2019-12-07 03:26:50
问题 I have the requirement to limit the number of characters a user can input into a TextField JavaFX control. I have extended TextField like so public class LengthLimitedTextField extends TextField { /** * @param maxCharacters The max allowed characters that can be entered into this {@link TextField}. */ public LengthLimitedTextField(final int maxCharacters) { final TextField thisField = this; this.textProperty().addListener(new ChangeListener<String>() { @Override public void changed

ListChangeListener wasPermutated block

喜欢而已 提交于 2019-12-07 03:22:36
问题 The JavaDoc for the ListChangeListener provides a template for handling changes. I don't know how to handle permutations, however. For every index, I can find out where the new index of the item is, but I don't know what to do with it. This is a bit of a puzzle that is independent of programming language. An ObservableList can only add(), remove(), set(), and also has an iterator. If I have an original list [1,2,3], and bind a list[] to it, the bound list[1,2,3] needs to match it. If the

How to set/remove insets in JavaFX TitledPane

好久不见. 提交于 2019-12-07 02:02:54
问题 I've created a TitledPane in JavaFX with a single child component (a button) as follows: <?import java.lang.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children> <TitledPane animated="false" layoutX="137.0" layoutY="60.0" prefHeight="400.0" prefWidth="600.0" text="untitled" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"

Mimicking CTRL+Click Multiple Selection in ListView using Javafx

房东的猫 提交于 2019-12-07 01:53:52
问题 I'm trying to find different ways of selecting multiple items in a ListView. The GUI will be running on a touch screen monitor, So I won't be able to CTRL+Click. From researching through various past posts, I have been able to implement Multiple Selection via keeping all the selected items in an Array and then looping through it to get the final selections. The only problem I have with my code is that compared to a CTRL +click , the selection is done smoothly, where as my code leads to a type

javafx8 TableView Multiselection returns one of the selected items as null

冷暖自知 提交于 2019-12-07 01:03:19
问题 TableView multi selection returns one of the selected objects as null. This doesn't happen every time but happens most of the times when i try to select two rows in the table.similar to the issue defined in this question Best way of reproducing the issue is , try selecting two sequential rows . FXML : <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Label?> <?import javafx.scene.control.ProgressBar?> <?import javafx.scene.control.TableColumn?> <?import javafx.scene.control

How to use intersect() method of Node Class in JavaFX?

白昼怎懂夜的黑 提交于 2019-12-06 21:34:31
JavaFX Node class provides two intersect methods: intersects(Bounds localBounds); and intersects(double localX, double localY, double localWidth, double localHeight); When and how can I use these methods? as it name tells it is used to determine if a node is intersected with other node or not.. Example : If you're going to develop Zen pong game in javafx ,if ball hits the wall behind paddle then game over. Code : private Circle ball; private Rectangle wall; if(ball.intersects(wall.getBoundsInLocal()) { //game over } 来源: https://stackoverflow.com/questions/20840587/how-to-use-intersect-method

Label text position

时光毁灭记忆、已成空白 提交于 2019-12-06 20:24:49
问题 I have a Label with an image and text final Label label = new Label(labelText); label.setTextAlignment(TextAlignment.CENTER); ImageView livePerformIcon = new ImageView(MainApp.class.getResource("/images/Folder-icon.png").toExternalForm()); label.setGraphic(livePerformIcon); I get this as a visual result: How I can change the text position? I want to set the text below the Image? 回答1: label.setContentDisplay(ContentDisplay.TOP); Play with this to see the effect of the different alignment

Javafxpackager: how do you set the “base JDK”?

自古美人都是妖i 提交于 2019-12-06 18:40:43
问题 When I run javafxpackager, I get the following warning/info: No base JDK. Package will use system JRE. It's not clear from the docs for Deploying JavaFX Applications how one would specify an alternative JDK. There isn't an option for it, that I can see (maybe I'm blind). Is it a system property? Thanks. 回答1: There is an old Oracle blog which mentions this. Don't know if it is still applicable or relevant to your case or not though: Self-Contained Applications: Select Java Runtime to bundle

Can you specify minor jdk version for travis ci

坚强是说给别人听的谎言 提交于 2019-12-06 17:16:36
问题 Is it possible to specify the minor version of the JDK for jobs running on Travis? I have a JavaFX project which is failing because JDK 1.8.0_31 is being used to perform the build where as the project uses some classes that were only shipped in Java 1.8.0_40 (specifically Alert and Spinner). Currently my .travis.yml file looks like below: language: java jdk: - oraclejdk8 Here's a link to the failed build just in case it's useful. 回答1: I finally got it working. This solution is not really