javafx

Why does JavaFX table.getItems().clear() clear the ObservableList as well

送分小仙女□ 提交于 2020-01-06 03:55:07
问题 I've a JavaFX table defined as: TableView<Person> table = new TableView<>; //Person Class contains firstName,lastName & email properties //table has three columns First Name, Last Name & Email An ObservableList of Person s ObservableList<Person> persons = FXCollections.observableArrayList(); A background service, which task is to populate the table dynamically by adding entries( Person objects) to the ObservableList persons . table is binded as: table.itemsProperty().bind(service

The count number of pressed button

你说的曾经没有我的故事 提交于 2020-01-06 03:51:05
问题 I need that when I press the button to show me how many times was the button pressed. I use this method, but on console still show me the number 1. Here is code: button_help.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { int count = 0; count ++; System.out.println(count); } }); 回答1: Your solution doesn´t work as you are reseting the value of variable every time you click button. You have to define it once and than just increase the valu of

JavaFx element not binding to controller variable on fx:id [duplicate]

不羁的心 提交于 2020-01-06 03:37:26
问题 This question already has answers here : JavaFX FXML controller - constructor vs initialize method (3 answers) Closed 3 years ago . This is likely pilot error, but the FXML attribute is not binding to the controller class on fx:id. I've whittled it down to a trivial example, but still "no joy". What am I overlooking? FXML file... <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.BorderPane?> <BorderPane fx:id="mainFrame" maxHeight="

using javafx client with spring boot and spring security

左心房为你撑大大i 提交于 2020-01-06 03:21:27
问题 I'm going to create a javafx client and http server using spring boot that includes authentication. The server is planning to use spring security for login and appache httpClient for clients. Can I create a login service from this structure? Or should I choose a different method? I understand Spring security authenticates using cookie and session. 回答1: You can make a hybrid application using JavaFX and Spring-Boot . And of course, you can use Spring Security as well. I recommend you to use

How to run Scene Builder in eclipse mars 2?

随声附和 提交于 2020-01-06 03:18:09
问题 I want to work with javafx and Scene Builder in eclipse mars 2. But there is no javafx item in eclipse menu. In file - new - others there is no javafx item to create javafx program. Then I try to install e(fx)clipse on eclipse and its done successfully but nothing add to my eclipse. How can I run Scene Builder with eclipse (mars 2) ? 回答1: You first need to download and install Scene Builder. Here is the official link of oracle scene builder archive. Download And if you've downloaded the e(fx

How to run Scene Builder in eclipse mars 2?

人盡茶涼 提交于 2020-01-06 03:18:07
问题 I want to work with javafx and Scene Builder in eclipse mars 2. But there is no javafx item in eclipse menu. In file - new - others there is no javafx item to create javafx program. Then I try to install e(fx)clipse on eclipse and its done successfully but nothing add to my eclipse. How can I run Scene Builder with eclipse (mars 2) ? 回答1: You first need to download and install Scene Builder. Here is the official link of oracle scene builder archive. Download And if you've downloaded the e(fx

JavaFX automatically resize Button's font size to fit in

谁说胖子不能爱 提交于 2020-01-06 02:58:51
问题 I am programming a JavFX UI on Java 8 where I create Buttons with sizes calculated at construction time. The problem is that the button's text (usually just a single letter in my case) sometimes is too big to fit in the button and then the button just stays blank. How can I set the font size for a JavaFX Button so that the text is not too high to not get displayed? 回答1: I found a solution. It's probably not very beautiful and I have no idea where the 0.45 come from (found it by trying), but

Marshalling ObservableList with JAXB

北战南征 提交于 2020-01-06 02:04:06
问题 I want to marshall an object "main" with JAXB, this are the attributes of the root class: private StringProperty mensaje; private bd database; private ObservableList<MarcoOntologicoColectivo> Inteligencia_colectiva=FXCollections.observableArrayList(); private ObservableList<agent> agentData = FXCollections.observableArrayList(); private ObservableList<MarcoOntologicoColectivo> Colectivo=FXCollections.observableArrayList(); private ObservableList<MarcoOntologicoColectivo> Belongs=FXCollections

JavaFX+MVC. How to hide/show multiple windows?

て烟熏妆下的殇ゞ 提交于 2020-01-06 02:00:07
问题 How to make that when i click on "Open second window" the main window be hide. And when i close second window, the main window be showed? I read this post, but i don't know how to implement it for my task. Thanks! I have next code: Main.java public class Main extends Application { @Override public void start(Stage primaryStage) { primaryStage.setTitle("First Stage"); try { primaryStage.setResizable(false); Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml")); Scene scene =

JavaFX Scale Elements to Screen Resolution

故事扮演 提交于 2020-01-06 01:46:15
问题 I've created a GUI in JavaFX using SceneBuilder that works perfectly in windowed mode. It looks like this; What I would like to do is run the program maximised (not full screen) and ideally have the elements resize according to whether the stage is maximised or not. This is what the GUI looks like when the program is maximised; As you can see for some bizzare reason the table does "scale" however none of the other elements do. Is there a setting in SceneBuilder I can use that makes the