guten morgen eine frage könnte mir jemand mit JFoenix weiterhelfen ???
mein problem ist ich habe eine JFXTextfield und möchte dieses mit einem KeyEvent "verknüpfen" wenn
die entertaste gedückt wird aber satt dessen bekomme ich immer eine Exception.
FXMLController
FXMLDocument.fxml
Exception
hoffe es kann mir jemand weiterhelfen
mein problem ist ich habe eine JFXTextfield und möchte dieses mit einem KeyEvent "verknüpfen" wenn
die entertaste gedückt wird aber satt dessen bekomme ich immer eine Exception.
FXMLController
Java:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package login_fxl;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXPasswordField;
import com.jfoenix.controls.JFXTextField;
import java.awt.event.KeyEvent;
import java.net.URL;
import java.sql.SQLException;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
/**
*
* @author KeinerEiner
*/
public class FXMLDocumentController implements Initializable {
String user_str_e = "";
String user_pw_str_e = "";
@FXML
private Label label;
private JFXTextField user;
private JFXPasswordField pwf;
private JFXButton btn_login;
private String user_str;
private String user_pw_str;
@FXML
public void handleKeyUserAction(KeyEvent event) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
}
@Override
public void initialize(URL url, ResourceBundle rb) {
}
}
FXMLDocument.fxml
CSS:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.effect.*?>
<?import com.jfoenix.controls.*?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="792.0" style="-fx-background-color: #1d1d1d;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="login_fxl.FXMLDocumentController">
<children>
<ImageView fitHeight="500.0" fitWidth="792.0" layoutX="-1.0" layoutY="-1.0" pickOnBounds="true">
<image>
<Image url="@../Images/bg-7.jpg" />
</image>
</ImageView>
<AnchorPane layoutX="250.0" layoutY="41.0" opacity="0.89" prefHeight="417.0" prefWidth="318.0" style="-fx-background-color: #3FC4E6;">
<children>
<JFXTextField fx:id="user" focusColor="#20285d" labelFloat="true" layoutX="27.0" layoutY="119.0" onAction="#handleKeyUserAction" prefHeight="30.0" prefWidth="265.0" promptText="Username" style="-fx-text-fill: #121343;" unFocusColor="#f2eeee">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXTextField>
<JFXPasswordField fx:id="pwf" focusColor="#20285d" labelFloat="true" layoutX="28.0" layoutY="191.0" prefHeight="30.0" prefWidth="265.0" promptText="Password" unFocusColor="#f8f5f5">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXPasswordField>
<JFXButton fx:id="btn_login" buttonType="RAISED" layoutX="26.0" layoutY="281.0" onAction="#handleButtonAction_login" prefHeight="30.0" prefWidth="265.0" style="-fx-background-color: #20386D;" text="Login" textFill="#f8f6f6">
<font>
<Font name="System Bold" size="16.0" />
</font>
<ripplerFill>
<LinearGradient endX="1.0" endY="1.0">
<stops>
<Stop color="BLACK" />
<Stop color="BLACK" offset="0.007662835249042145" />
<Stop color="WHITE" offset="1.0" />
</stops>
</LinearGradient>
</ripplerFill>
</JFXButton>
<Label layoutX="84.0" layoutY="26.0" text="Welcome" textFill="#0a55f5">
<font>
<Font name="System Bold" size="36.0" />
</font>
</Label>
</children>
</AnchorPane>
</children>
</AnchorPane>
Exception
Code:
Executing C:\Users\KeinerEiner\Documents\NetBeansProjects\Login_FXL\dist\run932012235\Login_FXL.jar using platform C:\Program Files\Java\jdk1.8.0_152\jre/bin/java
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: javafx.fxml.LoadException: Error resolving onAction='#handleKeyUserAction', either the event handler is not in the Namespace or there is an error in the script.
file:/C:/Users/KeinerEiner/Documents/NetBeansProjects/Login_FXL/dist/run932012235/Login_FXL.jar!/login_fxl/FXMLDocument.fxml:25
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:610)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:770)
at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at login_fxl.Login_FXL.start(Login_FXL.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
... 1 more
Exception running application login_fxl.Login_FXL
Java Result: 1
hoffe es kann mir jemand weiterhelfen