javafx-8

Consuming Events with EventFilters

橙三吉。 提交于 2019-12-20 04:15:43
问题 First, can anyone explain to me, why my MouseEvent gets consumed no matter which Alert -Option I choose? I guess it has something to do with calling an Alert within an EventFilter , but thats just not yet clear to me. public class EventFilterConsumeErrorExample extends Application { @Override public void start( final Stage primaryStage ) { final CheckBox checkBox = new CheckBox( "Check me!" ); checkBox.setOnAction( ( event ) -> { System.out.println( "onAction: " + checkBox.isSelected() ); } )

JavaFx: How to update text of dynimically created TextFields inside GridPane?

家住魔仙堡 提交于 2019-12-20 04:13:52
问题 I'm developing an app in JavaFx, in which which I'm dynamically creating TextFeids and CheckBoxes inside GridPane like this: I'm adding numbers which user will enter in TextField 1 and TextField 2 and displaying in TextField 3 like this using listener: Problem: What I want is when user will check the CheckBox it should add 10 to the value already present in the TextField 3 of (same row as of triggered CheckBox) and update the text of TextField 3, and when user will uncheck the CheckBox it

NullPointerException in JavaFX initialize in TableView

Deadly 提交于 2019-12-20 04:07:15
问题 I have this controller class for showing a database query in a TableView, but i am having error of NullPointerException with the "setCellValueFactory(new PropertyValueFactory" package aplicativo; import java.net.URL; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control

NullPointerException in JavaFX initialize in TableView

本小妞迷上赌 提交于 2019-12-20 04:07:14
问题 I have this controller class for showing a database query in a TableView, but i am having error of NullPointerException with the "setCellValueFactory(new PropertyValueFactory" package aplicativo; import java.net.URL; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control

JavaFX css border-radius issue

这一生的挚爱 提交于 2019-12-20 03:40:10
问题 I am trying to simulate the effect one would get from this css example: border-radius: 50%; From searching the API and reading posts on forums including this one, I found that I should be using -fx-background-radius . This however is not giving me the wanted effect. I setup a picture as the background using -fx-background-image:url(...) and then I want to make it into a circle. How can I achieve this? Update So I see that I was not being too specific so let me try to elaborate: I created a

Why StringProperty[value: “”] is displayed in my table

拥有回忆 提交于 2019-12-20 03:26:18
问题 I'm trying to show some information in a TableView , but I'm facing some issues that I can't fix. Here is what I'm trying to do: I have a Room object: public class Room { private SimpleStringProperty id; private SimpleStringProperty description; private SimpleStringProperty isForRepair; private SimpleStringProperty comment; public Room(String id, String description, String isForRepair, String comment) { this.id = new SimpleStringProperty(id); this.description = new SimpleStringProperty

Iterate TreeView nodes

倖福魔咒の 提交于 2019-12-20 02:53:38
问题 I'm using this code to iterate all TreeView nodes. for (TreeItem<DynamicTreeNodeModel> children1 : children) { ObservableList<TreeItem<DynamicTreeNodeModel>> children2 = children1.getChildren(); for (TreeItem<DynamicTreeNodeModel> children3 : children2) { ObservableList<TreeItem<DynamicTreeNodeModel>> children4 = children3.getChildren(); TreeItem<DynamicTreeNodeModel> tempValue = null; for (TreeItem<DynamicTreeNodeModel> children5 : children4) { // some logic } } } Is there any better way to

How to update textarea(console)in realtime in JavaFX without loosing flow or freezing the application

左心房为你撑大大i 提交于 2019-12-20 02:49:05
问题 I am new JFX and I am struggling with this. I am trying to run a simple simulation that has to print output (system.out and system.err) to textarea. public class ConsoleController { @FXML public TextArea consoleLogscreen; private class Console extends OutputStream { @Override public void write(int b) throws IOException { consoleLogscreen.appendText(String.valueOf((char) b)); } } @FXML public void initialize() throws IOException { Console console = new Console(); PrintStream ps = new

JavaFX 8 How to set program icon to alert?

╄→尐↘猪︶ㄣ 提交于 2019-12-19 21:55:16
问题 How can I set program icon to alert without using alert.initOwner() ? Why without initOwner ? It's because some alert must be shown before whole window is initialized, so there's no scene that I can put to initOwner function. 回答1: You can steal the DialogPane from an Alert instance, and add it to a regular Stage. A Node can only be the root of one Scene at a time, so you need to replace the root of the Alert’s Scene first: public class AlertWithIcon extends Application { @Override public void

How to set -fx-max-width to USE_PREF_SIZE in JavaFX css?

蓝咒 提交于 2019-12-19 19:47:08
问题 Im writing a JavaFX-8 application and was wondering if it's possible to set min- or max-width of (e.g.) a Button to USE_PREF_SIZE by css. The class Region defines USE_PREF_SIZE as Double.NEGATIVE_INFINITY , but how to set negative Infinity in css? The JavaFX Reference Guide defines -fx-min-width, -fx-pref-width, -fx-max-width as <number> and a <number> is defined with the following regex [+|-]? [[0-9]+|[0-9]*"."[0-9]+] So maybe it is impossible? I have tried (for fun) to assign the java way