javafx

建造者模式(Builder)

让人想犯罪 __ 提交于 2020-01-07 01:45:40
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 模仿lombok,照猫画虎,实现自己的建造者模式 使用静态内部类实现 package com.depen.builder; import javafx.util.Builder; /** * @Description:模仿lombok建造这模式 * @Author :YanDepeng * @Date :Created in 2020/1/6 20:20 * @Version : */ public class Man { private int age; private String name; private String sex; public static Man_Builder builder() { return new Man_Builder(); } private Man(int age, String name, String sex) { this.age = age; this.name = name; this.sex = sex; } @Override public String toString() { return "Man{" + "age=" + age + ", name='" + name + '\'' + ", sex='" + sex + '\'' + '}'; }

createDefaultSkin() returned null error in JavaFX custom control

≡放荡痞女 提交于 2020-01-06 23:50:36
问题 Dear Stackoverflow community, I've implemented a custom control in JavaFX extending Control class. Everything is just working fine, but I keep getting the error message Jan 30, 2015 8:33:31 AM javafx.scene.control.Control impl_processCSS SEVERE: The -fx-skin property has not been defined in CSS for CustomView@19e4d42 and createDefaultSkin() returned null. when I run the application. I read a lot about SkinBase and BehaviorBase , but since everything is working as it is supposed to, I would

JavaFX: TableView(fxml) filling with data

流过昼夜 提交于 2020-01-06 23:45:40
问题 either i am looking at it for to long... or i did not really understand it. In any case i am trying to fill a tableview that has been created using fxml (inc. Columns) with data. My Code works for the first (Title) column but not for the rest. (Yes "data" has all the info in it... checked with debug.) So can any1 tell me what i am doing wrong?? Here (hopefully all relevant) code (copied together): @FXML private TableColumn<sresult,String> cl_title; @FXML private TableColumn<sresult, String>

JavaFX: TableView(fxml) filling with data

北城余情 提交于 2020-01-06 23:45:08
问题 either i am looking at it for to long... or i did not really understand it. In any case i am trying to fill a tableview that has been created using fxml (inc. Columns) with data. My Code works for the first (Title) column but not for the rest. (Yes "data" has all the info in it... checked with debug.) So can any1 tell me what i am doing wrong?? Here (hopefully all relevant) code (copied together): @FXML private TableColumn<sresult,String> cl_title; @FXML private TableColumn<sresult, String>

Call a function that requires a KeyEvent parameter

老子叫甜甜 提交于 2020-01-06 21:59:44
问题 I would like to call this java function in another function. How can I manualy fire a KeyEvent? private void chooseItemByKey(KeyEvent event) I tried chooseItemByKey(new KeyEvent(null, null, null, null, null, KeyCode.DOWN, false, false, false, false)); to fire a KeyCode "Down" but my JRE told me there's a Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch The method needs the KeyEvent because I trigger it also by a key, but I need to

Why do we need converters for TextFormatters

喜欢而已 提交于 2020-01-06 20:10:46
问题 My professor said that it is 'ideal' to use a filter and a converter for a TextFormatter. I looked at his examples and tried them, but couldn't understand why we need a converter at all. From the docs: A Formatter describes a format of a TextInputControl text by using two distinct mechanisms: A filter (getFilter()) that can intercept and modify user input. This helps to keep the text in the desired format. A default text supplier can be used to provide the intial text. A value converter

Javafx growing memory usage when drawing image

邮差的信 提交于 2020-01-06 19:37:26
问题 I'm creating a quite simple Go board game in JavaFX. I stumbled on growing memory usage in my application and after reducing everything unnecessary, it appeared that even the minimal example causes huge memory growth overtime, its about 50 to 100MB/s . Here's the code: import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx

JAVA FX - Hide stage lost service task response

喜你入骨 提交于 2020-01-06 19:33:35
问题 In this post i was answer why my UI was blocking after service.start() call, and it is resolved. Now I have another "little" problem... after start() the service I will hide/close the stage to run the application on TrayIcon. I've noticed that with hide()/close() the stage, the Service will be blocked and never go in SUCCEEDED status. I've tried to remove this call and all works. How I can hide()/close() my stage without block the Service thread and so receive the answer for minimize on tray?

Bind over the observableList in JavaFx

穿精又带淫゛_ 提交于 2020-01-06 18:37:47
问题 I have a entity of some datasource. It has List of object Pojo. It can be get by ds.getRows(). I'm trying to bind TableView on this list very hard. tblHlp.itemsProperty().bindBidirectional(new SimpleListProperty<>(FXCollections.observableArrayList(ds.getRows()))); When I change that ObservableList which I created FXCollections.observableArrayList(ds.getRows())) tableView is changed too. But I want to get the same effect when I change List in ds (ds.getRows). Any ideas? 回答1: I don't think you

how to insert html code generated in javafx fxml project in an existing web page?

浪子不回头ぞ 提交于 2020-01-06 18:07:43
问题 I created a javafx fxml application project named "Login".It is working fine and I successfully made the project to run in browser (Firefox). while creating the project in Netbeans IDE 8.1 for the above project, it's html file was automatically created under the name "Login.html". Login.html <html><head> <SCRIPT src="./web-files/dtjava.js"></SCRIPT> <script> function launchApplication(jnlpfile) { dtjava.launch( { url : 'Login.jnlp', jnlp_content :