fxml

javafx fxml program error(no main method)

痞子三分冷 提交于 2021-01-29 03:11:01
问题 i'm fairly new to javafx and fxml. I'm trying to teach myself! However, when I was creating a program for a simple login GUI I came into an issue when I finally tried to run my program. It told me there was no main method in my class and I'm unsure of how to fix it. Any ideas? My program creates a login screen and when you enter "test" for the username and password it'll take you to another scene. Here is my Login.java package com; import javafx.application.Application; import javafx.fxml

How to pass parameters to a controller's constructor when using `<fx:include>`?

て烟熏妆下的殇ゞ 提交于 2021-01-28 17:52:01
问题 I am learning JavaFX, and I have come across an issue involving the instantiation of controllers that I can not seem to solve. Essentially, I am wondering if it is possible to do one of the following: Pass a parameter to the constructor of the controller when including FXML with <fx:include> ; or Specify a custom controller instance to use when including an FXML file with <fx:include> . Note that these issues are related. In fact, the reason I am asking about option (2) is because it would

JavaFX SceneBuilder: ClassNotFoundException when loading custom control

这一生的挚爱 提交于 2021-01-28 11:30:36
问题 I see that there are many posts about this, some slightly recent, some much older. Nonetheless, I would like to share my own experience because I am facing this issue and I cannot seem to find a solution. First of all, the context : I use Intellij IDEA Community Edition 20018.2.2 from 21st of August 2018 I use Scene Builder from GLUON, version 8.5.0 (latest as of this post) I use the JDK & JRE 64 bits version 8.181 (latest as of this post) The situation: I am writing a chat app. I have a

How can I get a reference to the controller of an FXML?

对着背影说爱祢 提交于 2021-01-28 09:08:05
问题 I'm trying to make a small "Login then Main Menu" form using JavaFX and Gluon's Scene Builder. I've made 2 scenes so far, the first one is a "Login" screen in which I've connected a SQLite Database, after putting the right Username and Password it loads perfectly fine and it changes to the second scene. For each scene I use a different class (FXML / FXML Controller). In the second scene I want 2 labels that I use to change according to the Database's data (More specifically First_Name and

Netbeans 8.2 autocomplete for FXML document is always showing “No suggestions”

自古美人都是妖i 提交于 2021-01-27 13:10:21
问题 I created a JavaFX project in Netbeans 8.2 for the first time and autocomplete for FXML document is always showing "No suggestions". For example: I have seen a similar question, e.g. Netbeans7.1 & JavaFX 2.0 - FXML code completion doesn't work, but I am not getting the same results from the solution proposed there (possibly because the version of Netbeans is different). What do I need to do to get autocomplete in FXML documents? Thanks! 回答1: Just for fun I installed Netbeans 8.1 for Java SE

In javafx how do i change the color of a button, wait 1 second than change it back do default?

≡放荡痞女 提交于 2020-12-15 05:04:21
问题 So i want to change the color of a button to light green, wait 1 second than change it back to default. How can i do this? I tried it this way: button1.setStyle("-fx-background-color: lightgreen"); try { Thread.sleep(1000); } catch(InterruptedException e) {} button1.setStyle(""); But i have 2 problems: the color never sets to light green, only to default. if i want to change it only to light green, it only changes after the 1 second of waiting and not before it. Edit: So i got to the part to

In javafx how do i change the color of a button, wait 1 second than change it back do default?

冷暖自知 提交于 2020-12-15 05:03:07
问题 So i want to change the color of a button to light green, wait 1 second than change it back to default. How can i do this? I tried it this way: button1.setStyle("-fx-background-color: lightgreen"); try { Thread.sleep(1000); } catch(InterruptedException e) {} button1.setStyle(""); But i have 2 problems: the color never sets to light green, only to default. if i want to change it only to light green, it only changes after the 1 second of waiting and not before it. Edit: So i got to the part to