javafx

JavaFX Change text under Progress Indicator (default: Done)

房东的猫 提交于 2020-01-05 08:02:09
问题 how can I change default text "Done" under ProgressIndicator in JavaFX? 回答1: This is a little bit tricky but it is possible: In JavaFX 2.2 this is made like this: ProgressIndicator indicator = new ProgressIndicator(); ProgressIndicatorSkin indicatorSkin = new ProgressIndicatorSkin(indicator); final Text text = (Text) indicatorSkin.lookup(".percentage"); indicator.progressProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> ov,

How to cancel selection in ListView?

有些话、适合烂在心里 提交于 2020-01-05 07:33:52
问题 I try to cancel user selection in a ListView according a condition. I tried to consume mouse clicked and mouse pressed event in ListView and ListCell but it didn't work. I don't understand why bu events occur after the selected item property change. How can I cancel the user selection? 回答1: If I understand correctly, you want to prevent users from selecting items by clicking on it. I further suppose that you tried a solution like this: listView.addEventHandler(MOUSE_CLICKED, click -> click

JavaFX make bar chart changing bars with delay in UI Thread

家住魔仙堡 提交于 2020-01-05 07:32:30
问题 I got JavaFX main thread, there I create new Thread that extends Task and sort and replace bars. Everyhing is good, but I want to make some delays(like 100ms) while replacing to show step by step sorting, maybe with animation. The problem is when I use Thread.sleep() or TranslateTransition() it just sum all delays miliseconds together in one big delay that happens before changing bars. How can I make delay that will work properly in UI thread? In main class: Sorting sorting = new Sorting();

How to cancel selection in ListView?

你说的曾经没有我的故事 提交于 2020-01-05 07:32:27
问题 I try to cancel user selection in a ListView according a condition. I tried to consume mouse clicked and mouse pressed event in ListView and ListCell but it didn't work. I don't understand why bu events occur after the selected item property change. How can I cancel the user selection? 回答1: If I understand correctly, you want to prevent users from selecting items by clicking on it. I further suppose that you tried a solution like this: listView.addEventHandler(MOUSE_CLICKED, click -> click

JavaFX, can't get GridPane to fit in the center of BorderPane

[亡魂溺海] 提交于 2020-01-05 07:18:44
问题 I'm working on a sudoku application but I'm having an issue which hinders my advancement. What I'm trying to do is to make this sudoku-board that I have created with loops, which adds a Label into a StackPane and that StackPane goes into it's designated spot into the GridPane. So I'm trying to force this board have a set size and not grow beyond that point. I've spent the whole evening researching and trying different things, for example putting the GridPane into an AnchorPane and trying to

Change TableColumn background in TableView, whilst retaining alternating row colour?

两盒软妹~` 提交于 2020-01-05 07:14:12
问题 I was wondering if I can add a "layer" of colour on top of a column (cell background) without losing entirely the alternating row colours already present. I was using setStyle, and that just adds a solid colour. TableView<LineItem> table = new TableView<>(); table.getSelectionModel().setCellSelectionEnabled(true); TableColumn<LineItem, String> column1 = new TableColumn<>("Test1"); column1.setCellValueFactory(cellData -> cellData.getValue().string1Property()); column1.setEditable(true); table

How to get the controller of an included FXML?

不羁岁月 提交于 2020-01-05 07:11:30
问题 I have a simple two tab application build around JavaFXML and scenebuilder. The tabs do nothing at present because I cannot get past a nullpointer exception when trying to load them. The java and fxml files are arranged in a Netbeans project like this: Main Application: The application main class MainApp.java sets the scene and is declared as follows: package tabpane; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application

Running JabRef on Windows with OpenJDK

試著忘記壹切 提交于 2020-01-05 07:03:54
问题 although I'm just trying to install JabRef, I am quite surprised that this seemingly easy task is giving me so much trouble. I am using Windows 10 and I want to use JabRef (the most current version, which is 4.3.1). I do not have the JRE oder JDK for Java 8, but I have the Oracle Java 12 JDK. JabRef requires a JDK 8 but I cannot download it from Oracle without login. (And since they are quite nosy, I refuse to sign up to get the download.) So, I tried to use OpenJDK but that does not come

JavaFX Slider: Track length? Tick Label Color?

若如初见. 提交于 2020-01-05 07:03:54
问题 .slider .track { -fx-pref-width: 300px; } .slider .axis-tick-label { -fx-text-fill: white; } My feeble attempts of writing CSS styles for the slider both don't work. I'm 100% sure my syntax is off. Any help? 回答1: You can do it by setting the -fx-pref-width attribute of slider and setting the -fx-tick-label-fill attribute of .slider .axis : .slider { -fx-pref-width: 300px; } .slider .axis { -fx-tick-label-fill: white; } Note: For vertical Slider , to affect the length of the track, you have to

Graphic automatically fill button

我的梦境 提交于 2020-01-05 06:57:10
问题 I'm using JavaFX, fxml, and css to display buttons with an image. When I change the size of the window, the image of the button nicely moves with the center of the button. I also want the image to scale up to, say, 80% of the button, but I can't figure out how to do that. A Java solution would be fine as well, if it can't be done in just fxml or css. The code is below, but I also made a repo with a MWE on GitHub. fxml <?import javafx.geometry.Insets?> <?import javafx.scene.layout.GridPane?> <