javafx | JavaFX code for various courses
kandi X-RAY | javafx Summary
kandi X-RAY | javafx Summary
JavaFX code for various courses (TDT4100, TDT4180, IT1901, Kodeklubben) or just personal experimentation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize the image grid
- Initialize grid
- Initialize the person panel
- Initialize the person table
- Initialize FXML component
- Initialize the person list
- Initializes the ship
- Initializes the board
- Called when mouse is clicked
- Mouse clicked
- Turn a mouse down
- Start the game
- Start the game
- Creates an image view which is used to represent the image
- Called when a key is pressed
- Load data from an input stream
- Arts the temperature converters
- Moves the mouse to the specified coordinates
- Saves a game file
- Initialize the board
- Start the tool
- Load the ship type
- Starts the screen
- Starts the FXML game
- Saves edit
- Starts the game
javafx Key Features
javafx Examples and Code Snippets
Community Discussions
Trending Discussions on javafx
QUESTION
ANSWER
Answered 2021-Jun-15 at 18:50Both Swing and JavaFX are single-threaded UI toolkits, and each has their own thread for rendering the UI and processing user events. Modifying Swing components and creating Swing windows (e.g. JFrame
s) must be done on the AWT event dispatch thread. Modifying JavaFX components must be done on the FX Application Thread.
Thus when you're working with both toolkits together, you have to be careful to delegate the appropriate actions to the appropriate threads. The Javadocs for JFXPanel
have more details.
Here's a complete example which includes a slight re-working of your code and shows how to move the different parts of the code to the appropriate thread:
QUESTION
Hello I am new to JavaFX and when working with tables cells I ran into some issue updating display data. I would like to be able to set up my table cells so that they listen to more than one value without having to initialized listeners in the update item method.
For example I have a bus class that contains three properties a string bus id a string street name and a movement bool. I currently have it setup with the bus id in column 1 and the current street in column 2 and would like to be able to set up such that if the bus is moving the street name is green and if stopped the street name is red. currently I have it set up that the setCellValueFactory for Column 2 is passed the street name property and in the updateItem method for those cells it initializes a listener for the movement bool to update the color. While this current works it is hard to work with should I add more listeners to the cell, can I pass the cell more than one property during the setCellValueFactory method or another such method on the table columns to have the cell call the updateItem method for multiple events.
...ANSWER
Answered 2021-Jun-15 at 13:19Given a standard JavaFX model class:
QUESTION
I have a function to change an image and its opacity in a JavaFX GUI:
...ANSWER
Answered 2021-Jun-14 at 18:43In the meantime I found out that the reason for not changing the image is that I run changeImage() before the initialization of the GUI is completed. If I wait about 500 mS before I sent the changeImage() command all works fine.
Below is the minimal code that demonstrates the issue I had:
QUESTION
I have a JavaFX project running perfectly with no exceptions on eclipse IDE. I'm trying to export it into a runnable jar, and then an executable. However, after exporting it into a runnable jar I get multiple exceptions when I run it. These exceptions don't appear when I run the app inside eclipse. They only show up when I run the jar (via command prompt). Here are the exceptions:
And here are my project files as well as the VM arguments used.
...ANSWER
Answered 2021-Jun-14 at 11:55you need to add classpath you need java 15 in cmd use this in your cmd
QUESTION
I've been trying to customize with css my JavaFX application...so far so good untill I reach the Datepicker... I tried a lot of different aproaches but none of them seem to work. Is there a way to make the Datepicker round just like my TextFields?
Actual JavaFX interface that I'm working on:
(btw, I'm using Java 8_111 with Netbeans 8.2 if that helps on something)
Greetings!
...ANSWER
Answered 2021-Jun-13 at 20:48You just need to individually set the background-radius
for the date-picker
itself, plus it's underlying text-field
and arrow-button
(which is the calendar button).
For example, using the following CSS:
QUESTION
I am currently trying to write a simple application in Java using JavaFX.
In the application I want to have a pop up window that prompts the user for input. This works fine, as long as the user doesn't try to open the pop up window again. If he does that the following error occurs:
...ANSWER
Answered 2021-Jun-13 at 14:06The OP's solution:
I figured it out, easy thing really, I added a parameter to the start function so when I call it I just give it a new GridPane() and it works perfectly fine.
Is really the wrong approach. As @James_D pointed out, static
is not a good idea for anything like this. Trying to keep with the original design as much as possible, I'd suggest this, which builds the PopUp just once, and re-displays it:
QUESTION
Maybe I'm misunderstanding something basic, but I'm experimenting with JavaFX and am baffled why scaling a Canvas (using .setScaleX/Y) with value of 2 doesn't result in canvas with two times bigger width/height.
The relevant code is this: (I'm not using any .fxml at this point)
...ANSWER
Answered 2021-Jun-13 at 11:18You've already added canvas to the pane, try to apply .setScaleX/Y before pane.getChildren().add(canvas)
.
QUESTION
I'm writing to an MS Word document (.docx) using Apache POI from a JavaFX UI. the String is in Arabic, and when it contains one pair of brackets, the output is okay, but when there are 2 pairs or a quote, the output is messy, even though it appears okay in Eclipse's console too. Here's my code:
...ANSWER
Answered 2021-Jun-13 at 04:52The parentheses are not RTL text as your arabic text is. So it leads to problems if they are not marked as LTR text. See https://en.wikipedia.org/wiki/Bidirectional_text#Table_of_possible_BiDi_character_types.
So either you mark each LTR character using U+200E LEFT-TO-RIGHT MARK
and then RTL characters using U+200F RIGHT-TO-LEFT MARK (RLM)
.
Or you are using U+202E RIGHT-TO-LEFT OVERRIDE (RLO)
before the text line having LTR charcters ((
and )
) and RTL characters mixed and U+202C POP DIRECTIONAL FORMATTING (PDF)
after that text line. That tells the word processing software exactly where RTL starts and ends. That leads to correct output for me.
Complete example:
QUESTION
Everything works when i use javafx of higher version than java version.
For example javafx 16 and java 11, but might there be theoretically any problems?
Should java and javafx versions match?
...ANSWER
Answered 2021-Jun-12 at 19:23From the JavaFX 16 Release Notes:
JavaFX 16 requires JDK 11 or later.
So to answer the question, as long as your version of the JDK is at least 11, it should be compatible with JavaFX 16, but you can also use higher versions.
QUESTION
I am building a version of Risk in JavaFX with FXML for school. Now we want to be able to right click a button to decrease the amount of troops in a country and left click it to increase the amount. The left click was pretty self explanatory as it is just an onAction, but how would we check for a right click on a button, through FXML?
...ANSWER
Answered 2021-Jun-11 at 13:45To react to a right mouse button click in javaFX, you would use the onMouseClicked
event handler, and in the MouseEvent
, check for which button was pressed using method getButton
, which will return a MouseButton
with value MIDDLE
, PRIMARY
, or SECONDARY
Controller code:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
Install javafx
You can use javafx like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the javafx component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page