javafx

JavaFX and CSS Styling

左心房为你撑大大i 提交于 2019-12-24 17:06:55
问题 I'm kind of new to CSS and was wondering if anyone can answer a questions for me. In a lot of CSS sample code I see sections like this: .listview{ ... -fx-background-color: -fx-box-border, -fx-control-inner-background ; ... } So my question is where do the -fx-box-border, -fx-control-inner-background values come from? They appear to be connstants defined somewhere but where and what are their values? Thanks in advance. 回答1: Values such as -fx-background-color are "looked-up colors" defined in

How can I get the keyboard Caps Lock state in javafx

烈酒焚心 提交于 2019-12-24 17:01:34
问题 In my project, how to keyboard caps lock on state. i have refer this question How can I get the Caps Lock state, and set it to on, if it isn't already?. but i am get solution in javafx. please give me solution.I am also ref for this site https://community.oracle.com/thread/2415027?tstart=0 回答1: You will want this import: import java.awt.Toolkit; If you are wanting it on no matter what, just turn it on with: Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true); If you

Read arbitrarily json data to a javafx treeview,and only show the first element of any array in it

大城市里の小女人 提交于 2019-12-24 16:41:29
问题 I need to show a json file on a javafx treeview,the structure of the json is unknown.Like the web site: json viewer site I show the tree for user to select path of a value(like xpath of xml),so if the json is too big,I only need to show the first element of any array in json. for example,the original data is: { name:"tom", schools:[ { name:"school1", tags:["maths","english"] }, { name:"school2", tags:["english","biological"] }, ] } I want to show: again:the structure of json is unknown,it is

Using POJOs as model layer in JavaFX application

旧巷老猫 提交于 2019-12-24 16:31:20
问题 I'm creating simple JavaFX application. I want my model layer to be completely independent from JavaFX - no StringProperty , IntegerProperty and etc. as fields. I want it to be POJO. Main reason to do so is that I want it to be Serializable. I've created DataRepository - simple CRUD-like interface and some implementations of it, so I can at anytime change where I store my data - XML file, SQLite database or anything else. I also have to somehow connect my data storage with JavaFX (to display

JavaFX: How to disable ScrollBars in TableView

不问归期 提交于 2019-12-24 16:08:31
问题 I hope everyone is doing well. I have a TableView in javafx and I would like the table behavior to truncate the image of the TableView when the parent pane resizes too small to display the data, instead of it becoming scrollable. To clarify, I just want the ScrollBars disabled or not visible, so they don't show up. Below is my hierarchy in case that helps. Things I've tried below I read this post, but the answer just makes the cells resize to fit the width, instead of disabling the ScrollBar.

Custom collision shape for Buttons in JavaFX

你。 提交于 2019-12-24 16:00:27
问题 Creating a custom button shape is easily done, but how is it possible to make sure that the new shape is also the "collision box" of the button itself? In this case I created two hexagnol shaped buttons and aligned them properly. The problem is that the collision box of the buttons is still rectangular and when you move the mouse from the upper button to the lower one you will notice that the collision box is strictly rectangular and makes the custom shapes kind of useless. Any way to create

Need clarification on changing data in javafx application thread

眉间皱痕 提交于 2019-12-24 15:40:54
问题 I've been migrating a project of mine to JavaFX and started running into thread issues. I'll attach a short example. After much searching I managed to sort out the problem. I can't change the tableView data outside of the fx application thread. I switched my code over from using SwingWorker to a Task. At first, that worked until I added a change listener to the table's observableList. I then received the error "Not on FX application thread;" The error happened inside the onChanged method when

JavaFx launch application and continue

荒凉一梦 提交于 2019-12-24 15:35:22
问题 I have the following 3 lines of code: 1 System.out.println("Starting program..."); 2 Application.launch((Gui.class)); 3 System.out.println("Continuing program..."); The problem is that when javafx application started the code after line 2 is not executed until I close javafx application. What is the right way to start javafx application and execute line 3 when javafx application is still running? EDIT 1 The only solution I found up till now is: 2 (new Thread(){ public void run(){ Application

Is it possible to embed a SWT Composite into a JavaFX scene?

拟墨画扇 提交于 2019-12-24 15:12:47
问题 I know that JavaFX 2.2 provides FXCanvas for embedding new JavaFX components into existing SWT Composites. Is it possible to do it the other way around? My motivation for trying this, is that there are currently some components missing in JavaFX. For example a TreeTable. I want to implement my application in JavaFX, use SWT as a fallback for missing components, and migrate those to JavaFX as soon they are ready. 回答1: no - you can not embedd heavy weight (=SWT) into a lightweight container (

IntelliJ Idea JavaFX debugging issue

谁说胖子不能爱 提交于 2019-12-24 15:08:34
问题 Debugging in IntelliJ idea for JavaFX has been a pain for me. Mainly because when I setup a breakpoint, IntelliJ will just show me all the backend class files that I don't care about. Is there a way to stop it from happening? I've tried stepping over but that doesn't work. Here's an example of what happens when I debug a getText() method. http://i.stack.imgur.com/9zSoX.png Any help? 回答1: You can add a breakpoint after the method and use f9 (resume program) so intellij skips the method you