Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javafx onaction not in the namespace #320

Open
Linuxuser1234 opened this issue Jul 13, 2022 · 0 comments
Open

javafx onaction not in the namespace #320

Linuxuser1234 opened this issue Jul 13, 2022 · 0 comments

Comments

@Linuxuser1234
Copy link

trying to make a popup window but when i run it i get this error hadn't find any working solutions yet
"C:\Program Files\Java\jdk-18.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.2\lib\idea_rt.jar=64045:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\awips\.m2\repository\org\openjfx\javafx-controls\18\javafx-controls-18.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-graphics\18\javafx-graphics-18.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-base\18\javafx-base-18.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-fxml\18\javafx-fxml-18.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-web\18\javafx-web-18.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-media\18\javafx-media-18.jar -p C:\Users\awips\.m2\repository\org\openjfx\javafx-fxml\18\javafx-fxml-18-win.jar;C:\Users\awips\.m2\repository\org\kordamp\ikonli\ikonli-javafx\12.3.0\ikonli-javafx-12.3.0.jar;C:\Users\awips\.m2\repository\eu\hansolo\tilesfx\11.48\tilesfx-11.48.jar;C:\Users\awips\IdeaProjects\bolt\boltgui\target\classes;C:\Users\awips\.m2\repository\org\kordamp\bootstrapfx\bootstrapfx-core\0.4.0\bootstrapfx-core-0.4.0.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-controls\18\javafx-controls-18-win.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-base\18\javafx-base-18-win.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-graphics\18\javafx-graphics-18-win.jar;C:\Users\awips\.m2\repository\org\controlsfx\controlsfx\11.1.1\controlsfx-11.1.1.jar;C:\Users\awips\.m2\repository\com\dlsc\formsfx\formsfx-core\11.3.2\formsfx-core-11.3.2.jar;C:\Users\awips\.m2\repository\org\kordamp\ikonli\ikonli-core\12.3.0\ikonli-core-12.3.0.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-media\18\javafx-media-18-win.jar;C:\Users\awips\.m2\repository\org\openjfx\javafx-web\18\javafx-web-18-win.jar;C:\Users\awips\.m2\repository\net\synedra\validatorfx\0.2.1\validatorfx-0.2.1.jar -m com.bolt.boltgui/com.bolt.boltgui.boltgui Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at javafx.graphics@18/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:465) at javafx.graphics@18/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1081) Caused by: java.lang.RuntimeException: Exception in Application start method at javafx.graphics@18/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901) at javafx.graphics@18/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: javafx.fxml.LoadException: Error resolving onAction='#Popup1', either the event handler is not in the Namespace or there is an error in the script.
`package com.bolt.boltgui;
import java.io.IOException;
import java.net.URL;
import java.util.Objects;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.*;
public class ButtonController implements Initializable{
@FXML
private Button Skewt;
@OverRide
public void initialize(URL location, ResourceBundle resources) {
}
@FXML
private void Skewt(ActionEvent event) throws IOException {
Parent SkewtParent = FXMLLoader.load((URL) Objects.requireNonNull(Skewtplotter.getResource("Skewtplotter.fxml")));
Scene Scene = new Scene(SkewtParent);
Stage popup1 = new Stage();
popup1.setScene(Scene);
Skewt.setOnAction((EventHandler) event);
popup1.show();

}

}`
and on the ActionEvent i replaced event with Popup1 and Skewt.setOnAction((EventHandler) event); with Popup1 it still wouldn't work i changed it back to event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant