Questions tagged [javafx]

12272 questions
0

votes
1

answer
45

Views

Random generator creates the same numbers

While looping through a for loop which is randomly 1-10 long. I also go through a while loop. I am trying to find 6 random numbers between 1-42. I then do that again (1-10) times. Currently, these 6 random numbers stay the same. I suspect it has something to do with the seed but I could not solve it...
Davidenko
-1

votes
1

answer
21

Views

JavaFX update progress bar and wait for threads to complete

I'm trying to update a progress bar in Java FX. My first problem was that the window said 'not responding' instead of actually updating. It just froze and then after the tasks were done, the progress bar became full. So I found out that I had to use multithreading and implemented it like this. overa...
Karan Bijani
1

votes
1

answer
629

Views

How to perform input checks in TextInputDialog in JavaFX?

I have the code below. It describes a simple TextInputDialog (which contains a text field and OK button). How can I perform input checks? (e.g verify that the input is numeric/not-empty and so and so). In the bottom line, I want that the OK button will be disabled if the input is wrong, or if I pres...
HadarShab
1

votes
1

answer
478

Views

Filtering ObservableList with CheckBox in JavaFX

I'm building a log reader with JavaFX as a side project and have gotten to a dead end when trying to implement filtering on the TableView. What I have is a few CheckBoxes (LHS of the picture) that will basically act as the filters for what the TableView will display: Once the Submit button is clicke...
Kobbi Gal
1

votes
2

answer
52

Views

Cannot run jar on ubuntu with JFX

Good day, I am trying to run a program called graphdb-native-app-8.8.1-jfx.jar on a ubuntu virtual machine. I have the latest version of java installed, and have made sure JAVA_HOME is set to the correct java-version. java -version java version '11.0.2' 2019-01-15 LTS Java(TM) SE Runtime Environment...
Andrew Malcolm
1

votes
1

answer
36

Views

Connecting SQL Server with Java (javafx)

I have the setup below for the connection SQL Server with Java. Am also using javafx. I am very new to developing with Java. Note: I added the sqljdbc driver. I don't want to add main to DBConnection because am using the Connection method in the controller. Is there a way to fix this or how can I ad...
NAHEEM OLANIYAN
1

votes
2

answer
53

Views

Adjust opacity of an image in JavaFX

import javafx.application.Application; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import java.util.logging.Level; import java.util.logging.Logger; import javafx.animation.FadeTransition; import javafx.embed.swing.SwingFXUtils;...
dydx
1

votes
1

answer
33

Views

How set text color of combobox?

I'm trying to set the text color of combobox. My code, which I tried comboList.setStyle('-fx-text-fill: blue');
Martin
1

votes
2

answer
33

Views

How to set image as background using JavaFX?

I'm trying to put an image as a background in a JavaFX scene, but my code isn't working. Im trying to make a Battleship-game program in java eclipse but i'm stuck at a graphics problem. public class WindowGUI extends Application{ Game game; Image image; public WindowGUI(Game game) { this.game = game...
Mampenda
0

votes
0

answer
3

Views

More efficient way to add Panes to an HBox?

I am working on a project that is going to involve adding panes (or hboxes if that works better) to a very wide HBox. I set it up in an fxml pretty easily but I'm already going to have to make a few of these and I would love to avoid all the copying pasting. So I figured I should try and use a for l...
ameenazon
1

votes
1

answer
2.8k

Views

Detect OS and Java on Windows and Linux

I have a JavaFX project based on Maven. I want to build the Maven project on Windows and on Linux. In order to automate the process when I deploy the bundle I want to automatically detect the operating system. In windows I have this configuration: org.apache.maven.plugins maven-compiler-plugin 3.1 1...
Peter Penzov
1

votes
2

answer
759

Views

How do you add a tick to javafx?

I was wondering how to add a tick to javafx. By tick i mean a repetitive thread that updates the scene. I have tried an normal thread but I keep getting error that is is not the application thread. I would like it to start in the initialize method here is a heavily simplified version of my MainConto...
0

votes
1

answer
13

Views

How can i return deleted treeitems in javafx treeview?

How can i returned removed treeitems in Javafx treeview? When i make a tree like this. root- |-item1 |-item2 |-folder1- |-item3 |-item4 |-item5 |-folder2-.... |-folder3-.... if i delete folder1 i want to get some list of removed items and fodlers, it means that if i remove folder1 i want to get list...
HyungjinJeon
1

votes
2

answer
4.9k

Views

Creating a custom tree with javafx

Basically, I wanted to know if I could create a tree and custom it on javaFX... I tried to do it, but couldn't do anything so far with this code... public class Main{ ...... public Main() throws Exception{ ...... // TreeView created TreeView tv = (TreeView) fxmlLoader.getNamespace().get('treevie...
Damiii
1

votes
2

answer
1.4k

Views

ImageView SetImage NullPointer Exception

So I have this code in JavaFX: Image img = new Image('http://docs.oracle.com/javafx/javafx/images/javafx-documentation.png'); imgView_movie.setImage(img) Here's my fxml code, I added a default image value for it: I don't know if there's anything wrong but I keep getting this error: javafx.fxml.LoadE...
phoenixWright
0

votes
0

answer
17

Views

JavaFX setOnKeyPressed() event not being called?

Currently my setOnKeyPressed() method is not being called in my application. this.getRoot().setOnKeyPressed(createKeyHandler()); this.getRoot().requestFocus(); The above code is being called in my class. this.getRoot returns the root VBox of GUI application. private EventHandler
Joe
1

votes
1

answer
536

Views

JavaFX - Storing Data to corresponding button

Disclaimer: I'm completely new to JavaFX. With that said, I'm making an Othello game, naturally I'll have an 8x8 boardgame. I have enums for the state of each board square: empty, black, white. For each board square, I have a button. I have it where I can change the color, keep track of turns, etc....
mKDoodle
1

votes
1

answer
356

Views

Distribute remaining space in GridPane or how to do it

We need a solution for a 3 column layout with the following requirements: The middle column has a fixed size The middle column is centered in the parent The other two columns both share the remaining space The other two columns both have the same size Let's say we have an amount of horizontal space...
Guardian667
0

votes
0

answer
5

Views

How do I control the position of a carat in a TableView Column header?

I notice that there is a carat available in a date column of a TableView which allows the user to toggle the view between descending and ascending order. However the carat it not initially visible until the user clicks somewhere in the table header row, and then it appears at whatever position the c...
Rusty
1

votes
1

answer
67

Views

How to create a JavaFX TableView without warnings?

I'm following a tutorial by Oracle to create a TableView in JavaFX. In this screenshot, I've copied and pasted the code and I get several errors, which aren't mentioned in the tutorial anywhere. The warning on the TableView says: TableView is a raw type. References to generic type TableView should...
JolonB
1

votes
1

answer
63

Views

How can I show a random light with a traffic light?

I am a beginner with programming and coding. I try to make random things to develop myself. I drawed a traffic light with JavaFX. Now I want to when I click on the button a random light will glow. I've tried it with a switch and else elseif. I did not come to a solution public StoplichtLayout(Pane l...
Rico Papillon
1

votes
3

answer
58

Views

Indefinite task in ExecutorService

I have the following variables: private ExecutorService executor; private Task worker; I have a task that should be performed in another thread and the state of which should be monitored: public Worker updateTemplateBuffer() { worker = new Task() { @Override protected Boolean call() throws Exception...
A1ex NS
1

votes
1

answer
33

Views

How to pass different Generics in a Callback Class?

For a JFXTreeTableColumn I wrote a custom Cell Factory as Callback. Code works fine but what if I want to pass different Generics? I already tried to pass the Generics as ? or T, S but I definitely did something wrong public class CallbackImpl implements Callback { private final ObservableList payme...
thober35
1

votes
2

answer
51

Views

Can I set the label text in JavaFX using threads?

I want to constantly display the current mileage of the car without clicking on any button, etc. Thread class package threads; import javafx.fxml.FXML; import javafx.scene.control.Label; import static controller.GameWindowController.*; public class MileageThread implements Runnable { @FXML Label mil...
radek.jankowski
1

votes
2

answer
107

Views

JavaFX: How to move “drop down arrow” in TitledPane to be on right

I hope everyone is doing well. I'm trying to move the drop down arrow in a TitledPane to be laid out on the right, instead of the left like it is by default. I'm using JavaFX 8, and many of the resources I've found don't seem to work. I have found that I am able to move the arrow a specific amount,...
Terry Dorsey
1

votes
2

answer
45

Views

How to make a shape's dimensions fit around an image? - JavaFX

I am making a JavaFX based game that shoots drones using a spaceship to defend your base. I want to wrap a shape around an image to create a hitbox for it. This will allow the laser to cause damage to the drone whenever it touches the hitbox. It will make the game look better than the laser hitting...
Compiler v2
1

votes
2

answer
42

Views

JavaFX: 2 independent windows at once

I'd like to create 2 independent windows at once. One window would be able to hold an observable list, the other one would show the selected listobject's properties. I'm trying to create the listview as a generic list, and combine it with an object specific window (eg. customer properties, beer prop...
iCV
0

votes
2

answer
77

Views

How to solve the “Graphics Device initialization failed for : d3d, sw” Problem

I had problems with JavaFX 11+ a few days ago. Here you can see the bugs thrown out of the compiler: Graphics Device initialization failed for : d3d, sw Error initializing QuantumRenderer: no suitable pipeline found java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumR...
Mikail B
0

votes
0

answer
6

Views

Gridpane is null

I am creating a battleship game using GridPane's as the playable grid area. Therefor I will need to 'draw' out each block, setting it's fill and stroke. However, on compilation, I recieve a 'NullPointerException' and after looking into it, the GridPane is not being set for some reason. Placing some...
Duck
1

votes
0

answer
43

Views

Javafx: How to group mouse actions over an image

I am a newbie in Javafx and I am trying to fix a cropping over an image. I found an interesting solution for cropping with rubber band and now I try to modified this in my scenario. I have two controllers. One controller has the crop button (CropController) and another controller which contain an im...
ShrnPrmshr
1

votes
3

answer
485

Views

JavaFX : How to control input in a TextField ?

I try to do an application with JavaFX. I have a little question : I have a TextField and i would like it will be a TextField for 'phone number' (0477/40.00.09 for example). Unfortunatly, i can't do this. I would like that '/' and '.' are always write in the TextField. I also would like when the u...
Mikis Millemaci
1

votes
0

answer
313

Views

Javafx : ComboBoxTableCell - how to select a value in one click?

I have a TableView with a ComboBoxTableCell, when using the default implementation the user have to click three times to select a value from of the ComboBox's list. I want when the user clicks on the cell to show the combo box list. I based my solution on this one: JavaFX editable ComboBox in a tab...
joepol
1

votes
1

answer
58

Views

Save data into MySQL DB using Hibernate @ManyToOne relationship [duplicate]

This question already has an answer here: How to use @Id with String Type in JPA / Hibernate? 3 answers Edited (not exact duplicate of How to use @Id with String Type in JPA / Hibernate?) Reasons: At the time, the error I was getting was this: org.hibernate.id.IdentifierGenerationException: Unknown...
Adrian Flores
1

votes
0

answer
437

Views

Gradle: Build APK from JavaFX Application

I try to port a simple JavaFX application to Android by generating an apk-file with Gradle. But unfortunately the installation of my generated app to an android device is always failing with the following error: 'INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113.'. Proje...
Nighty42
1

votes
0

answer
117

Views

Hibernate Exception-Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for:

I hava a problem in the server side of my project. I used hibernate for this. There are three entities such as account,chat and chataccount. Account entity is shown below. I didn't use any annotation to getters or setters. @Entity public class Account { @Id @GeneratedValue(strategy = GenerationType....
Vidurajith Darshana
0

votes
0

answer
5

Views

Unable to create a new Task for progress bar in Java FX

I have created a progress bar in mine Java FXML controller UI and passing the values to it thru executeWSButton. I am creating the new task in createWorker() Method and binding the property value to the progress bar. The issue is now I am not able to create new Task() in createWorker() method.It was...
Narendra
1

votes
3

answer
574

Views

Why is font name not changing? (Java FX)

I'm having a problem with a javafx label. No matter what font I type in the below font constructor, compile and run the IntelliJ project, it doesn't change the font displayed. mainLabel.setFont(new Font('Gotham',18)); Here is my JavaFx Program so far: import javafx.application.Application; import j...
Akshay Chugh
1

votes
0

answer
366

Views

Getting NullPointerException when button is clicked (JavaFX and FXML) [duplicate]

This question already has an answer here: What is a NullPointerException, and how do I fix it? 12 answers What's the difference between fx:id and id: in JavaFX? 4 answers After finally getting the gui to run without problems whenever i click on a designated button the IDE (Eclipse) putting out a l...
Arad Zekler
1

votes
2

answer
53

Views

Running a thread by toggling a flag externally (from GUI)

I am making a simple JavaFX college course project and I need a good way of dealing with threads, mainly running them while a certain flag is activated. This is a simple sketch I came up with: public class ListenerService extends Thread { private static ArrayList listeners = new ArrayList(); private...
0lt
1

votes
1

answer
255

Views

Using Map with TableView in JavaFX

I am trying display a Map in TableView in JavaFX. The code below works just fine but the issue I am having is that any future Map's update after initialize doesn't show in the TableView. public class TableCassaController extends TableView implements Initializable { @FXML private TableColumn column...
Moe

View additional questions