fxml LoadException only when using MouseEvent ! (Java + Scene Builder) [duplicate]
This question already has an answer here:
Error resolving “onAction” while loading FXML
1 answer
I have a problem, i have an event handler that should do some code, apart from the code, the event handler accepts a MouseEvent and the event that will invoke it is onMouseClicked event, Everytime i try to run the program i get an exception, if i remove the MouseEvent and leave it empty or put any other type of event like just Event or ActionEvent it works, but this is not logical plus i need the mouse event because i will then check which mouse button is clicked in my code. i reviewed other people having the same questions and i did all what was in the answers to them but didn't work.
Exception + Stacktrace:
javafx.fxml.LoadException: Error resolving onMouseClicked='#maginfyRecord', either the event handler is not in the Namespace or there is an error in the script.
file:/D:/Personal/Projects/Tools/Java/Organizer/dist/run1842687407/Organizer.jar!/organizer/View/DatabaseTables.fxml:195
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 organizer.Controller.Main.switchWindow(Main.java:32)
at organizer.Controller.SecurityController.openOrSave(SecurityController.java:124)
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.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
The event handler is as follows:
@FXML
public void magnifyRecord(MouseEvent event) {
if ((event.getButton()== event.BUTTON2)) {
TextArea area = new TextArea();
area.setText(selectedTable.getSelectionModel().getSelectedItem().toString());
JFXPopup popup = new JFXPopup();
popup.setPopupContent(area);
popup.show(selectedTable);
popup.show(selectedTable, event.getX(), event.getY());
}
}
and here is the fxml for this portion:
<Tab fx:id="toDoListTab" onSelectionChanged="#switchTab" text="To Do List">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="toDoListTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="notesTab" onSelectionChanged="#switchTab" text="Notes">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="notesTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="contactsTab" onSelectionChanged="#switchTab" text="Contacts">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="contactsTable" onMouseClicked="#magnifyRecord" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="locationsTab" onSelectionChanged="#switchTab" text="Locations">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="locationsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="productsTab" onSelectionChanged="#switchTab" text="Products">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="productsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
I tried commenting out the code completely, no change, it only works if i remove the MouseEvent or replace it with any other event
I am using Netbeans + JDK 8 + Scene Builder + jfoenix library
java javafx fxml scenebuilder jfoenix
marked as duplicate by fabian
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 11:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Error resolving “onAction” while loading FXML
1 answer
I have a problem, i have an event handler that should do some code, apart from the code, the event handler accepts a MouseEvent and the event that will invoke it is onMouseClicked event, Everytime i try to run the program i get an exception, if i remove the MouseEvent and leave it empty or put any other type of event like just Event or ActionEvent it works, but this is not logical plus i need the mouse event because i will then check which mouse button is clicked in my code. i reviewed other people having the same questions and i did all what was in the answers to them but didn't work.
Exception + Stacktrace:
javafx.fxml.LoadException: Error resolving onMouseClicked='#maginfyRecord', either the event handler is not in the Namespace or there is an error in the script.
file:/D:/Personal/Projects/Tools/Java/Organizer/dist/run1842687407/Organizer.jar!/organizer/View/DatabaseTables.fxml:195
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 organizer.Controller.Main.switchWindow(Main.java:32)
at organizer.Controller.SecurityController.openOrSave(SecurityController.java:124)
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.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
The event handler is as follows:
@FXML
public void magnifyRecord(MouseEvent event) {
if ((event.getButton()== event.BUTTON2)) {
TextArea area = new TextArea();
area.setText(selectedTable.getSelectionModel().getSelectedItem().toString());
JFXPopup popup = new JFXPopup();
popup.setPopupContent(area);
popup.show(selectedTable);
popup.show(selectedTable, event.getX(), event.getY());
}
}
and here is the fxml for this portion:
<Tab fx:id="toDoListTab" onSelectionChanged="#switchTab" text="To Do List">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="toDoListTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="notesTab" onSelectionChanged="#switchTab" text="Notes">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="notesTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="contactsTab" onSelectionChanged="#switchTab" text="Contacts">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="contactsTable" onMouseClicked="#magnifyRecord" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="locationsTab" onSelectionChanged="#switchTab" text="Locations">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="locationsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="productsTab" onSelectionChanged="#switchTab" text="Products">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="productsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
I tried commenting out the code completely, no change, it only works if i remove the MouseEvent or replace it with any other event
I am using Netbeans + JDK 8 + Scene Builder + jfoenix library
java javafx fxml scenebuilder jfoenix
marked as duplicate by fabian
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 11:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
post the whole fxml and the controller class, dont post it here link it using pastebin or something
– Ryotsu
Nov 25 '18 at 5:03
@th3sp33dst3r ok i added it.
– Zeyad
Nov 25 '18 at 5:08
@th3sp33dst3r i checked now, turned out that this was the issue, that was very stupid from me, i have been trying to solve this for a long time. after your comment i found that i imported another import for the MouseEvent, you can put this comment as an answer and i will upvote and accept it because you really deserve that, you even suspected the issue without seeing the import statements
– Zeyad
Nov 25 '18 at 5:18
add a comment |
This question already has an answer here:
Error resolving “onAction” while loading FXML
1 answer
I have a problem, i have an event handler that should do some code, apart from the code, the event handler accepts a MouseEvent and the event that will invoke it is onMouseClicked event, Everytime i try to run the program i get an exception, if i remove the MouseEvent and leave it empty or put any other type of event like just Event or ActionEvent it works, but this is not logical plus i need the mouse event because i will then check which mouse button is clicked in my code. i reviewed other people having the same questions and i did all what was in the answers to them but didn't work.
Exception + Stacktrace:
javafx.fxml.LoadException: Error resolving onMouseClicked='#maginfyRecord', either the event handler is not in the Namespace or there is an error in the script.
file:/D:/Personal/Projects/Tools/Java/Organizer/dist/run1842687407/Organizer.jar!/organizer/View/DatabaseTables.fxml:195
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 organizer.Controller.Main.switchWindow(Main.java:32)
at organizer.Controller.SecurityController.openOrSave(SecurityController.java:124)
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.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
The event handler is as follows:
@FXML
public void magnifyRecord(MouseEvent event) {
if ((event.getButton()== event.BUTTON2)) {
TextArea area = new TextArea();
area.setText(selectedTable.getSelectionModel().getSelectedItem().toString());
JFXPopup popup = new JFXPopup();
popup.setPopupContent(area);
popup.show(selectedTable);
popup.show(selectedTable, event.getX(), event.getY());
}
}
and here is the fxml for this portion:
<Tab fx:id="toDoListTab" onSelectionChanged="#switchTab" text="To Do List">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="toDoListTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="notesTab" onSelectionChanged="#switchTab" text="Notes">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="notesTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="contactsTab" onSelectionChanged="#switchTab" text="Contacts">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="contactsTable" onMouseClicked="#magnifyRecord" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="locationsTab" onSelectionChanged="#switchTab" text="Locations">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="locationsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="productsTab" onSelectionChanged="#switchTab" text="Products">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="productsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
I tried commenting out the code completely, no change, it only works if i remove the MouseEvent or replace it with any other event
I am using Netbeans + JDK 8 + Scene Builder + jfoenix library
java javafx fxml scenebuilder jfoenix
This question already has an answer here:
Error resolving “onAction” while loading FXML
1 answer
I have a problem, i have an event handler that should do some code, apart from the code, the event handler accepts a MouseEvent and the event that will invoke it is onMouseClicked event, Everytime i try to run the program i get an exception, if i remove the MouseEvent and leave it empty or put any other type of event like just Event or ActionEvent it works, but this is not logical plus i need the mouse event because i will then check which mouse button is clicked in my code. i reviewed other people having the same questions and i did all what was in the answers to them but didn't work.
Exception + Stacktrace:
javafx.fxml.LoadException: Error resolving onMouseClicked='#maginfyRecord', either the event handler is not in the Namespace or there is an error in the script.
file:/D:/Personal/Projects/Tools/Java/Organizer/dist/run1842687407/Organizer.jar!/organizer/View/DatabaseTables.fxml:195
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 organizer.Controller.Main.switchWindow(Main.java:32)
at organizer.Controller.SecurityController.openOrSave(SecurityController.java:124)
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.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.Button.fire(Button.java:185)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
The event handler is as follows:
@FXML
public void magnifyRecord(MouseEvent event) {
if ((event.getButton()== event.BUTTON2)) {
TextArea area = new TextArea();
area.setText(selectedTable.getSelectionModel().getSelectedItem().toString());
JFXPopup popup = new JFXPopup();
popup.setPopupContent(area);
popup.show(selectedTable);
popup.show(selectedTable, event.getX(), event.getY());
}
}
and here is the fxml for this portion:
<Tab fx:id="toDoListTab" onSelectionChanged="#switchTab" text="To Do List">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="toDoListTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="notesTab" onSelectionChanged="#switchTab" text="Notes">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="notesTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="contactsTab" onSelectionChanged="#switchTab" text="Contacts">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="contactsTable" onMouseClicked="#magnifyRecord" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="locationsTab" onSelectionChanged="#switchTab" text="Locations">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="locationsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
<Tab fx:id="productsTab" onSelectionChanged="#switchTab" text="Products">
<content>
<StackPane prefHeight="150.0" prefWidth="200.0">
<children>
<TableView fx:id="productsTable" prefHeight="200.0" prefWidth="200.0" />
</children>
</StackPane>
</content>
</Tab>
I tried commenting out the code completely, no change, it only works if i remove the MouseEvent or replace it with any other event
I am using Netbeans + JDK 8 + Scene Builder + jfoenix library
This question already has an answer here:
Error resolving “onAction” while loading FXML
1 answer
java javafx fxml scenebuilder jfoenix
java javafx fxml scenebuilder jfoenix
edited Nov 25 '18 at 5:07
Zeyad
asked Nov 25 '18 at 4:52
ZeyadZeyad
601210
601210
marked as duplicate by fabian
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 11:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by fabian
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 25 '18 at 11:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
post the whole fxml and the controller class, dont post it here link it using pastebin or something
– Ryotsu
Nov 25 '18 at 5:03
@th3sp33dst3r ok i added it.
– Zeyad
Nov 25 '18 at 5:08
@th3sp33dst3r i checked now, turned out that this was the issue, that was very stupid from me, i have been trying to solve this for a long time. after your comment i found that i imported another import for the MouseEvent, you can put this comment as an answer and i will upvote and accept it because you really deserve that, you even suspected the issue without seeing the import statements
– Zeyad
Nov 25 '18 at 5:18
add a comment |
post the whole fxml and the controller class, dont post it here link it using pastebin or something
– Ryotsu
Nov 25 '18 at 5:03
@th3sp33dst3r ok i added it.
– Zeyad
Nov 25 '18 at 5:08
@th3sp33dst3r i checked now, turned out that this was the issue, that was very stupid from me, i have been trying to solve this for a long time. after your comment i found that i imported another import for the MouseEvent, you can put this comment as an answer and i will upvote and accept it because you really deserve that, you even suspected the issue without seeing the import statements
– Zeyad
Nov 25 '18 at 5:18
post the whole fxml and the controller class, dont post it here link it using pastebin or something
– Ryotsu
Nov 25 '18 at 5:03
post the whole fxml and the controller class, dont post it here link it using pastebin or something
– Ryotsu
Nov 25 '18 at 5:03
@th3sp33dst3r ok i added it.
– Zeyad
Nov 25 '18 at 5:08
@th3sp33dst3r ok i added it.
– Zeyad
Nov 25 '18 at 5:08
@th3sp33dst3r i checked now, turned out that this was the issue, that was very stupid from me, i have been trying to solve this for a long time. after your comment i found that i imported another import for the MouseEvent, you can put this comment as an answer and i will upvote and accept it because you really deserve that, you even suspected the issue without seeing the import statements
– Zeyad
Nov 25 '18 at 5:18
@th3sp33dst3r i checked now, turned out that this was the issue, that was very stupid from me, i have been trying to solve this for a long time. after your comment i found that i imported another import for the MouseEvent, you can put this comment as an answer and i will upvote and accept it because you really deserve that, you even suspected the issue without seeing the import statements
– Zeyad
Nov 25 '18 at 5:18
add a comment |
1 Answer
1
active
oldest
votes
Try checking your imports, you must've imported the wrong MouseEvent. You should import
javafx.scene.input.MouseEvent
for the event handler and not any other MouseEvents.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try checking your imports, you must've imported the wrong MouseEvent. You should import
javafx.scene.input.MouseEvent
for the event handler and not any other MouseEvents.
add a comment |
Try checking your imports, you must've imported the wrong MouseEvent. You should import
javafx.scene.input.MouseEvent
for the event handler and not any other MouseEvents.
add a comment |
Try checking your imports, you must've imported the wrong MouseEvent. You should import
javafx.scene.input.MouseEvent
for the event handler and not any other MouseEvents.
Try checking your imports, you must've imported the wrong MouseEvent. You should import
javafx.scene.input.MouseEvent
for the event handler and not any other MouseEvents.
answered Nov 25 '18 at 5:21
RyotsuRyotsu
565313
565313
add a comment |
add a comment |
post the whole fxml and the controller class, dont post it here link it using pastebin or something
– Ryotsu
Nov 25 '18 at 5:03
@th3sp33dst3r ok i added it.
– Zeyad
Nov 25 '18 at 5:08
@th3sp33dst3r i checked now, turned out that this was the issue, that was very stupid from me, i have been trying to solve this for a long time. after your comment i found that i imported another import for the MouseEvent, you can put this comment as an answer and i will upvote and accept it because you really deserve that, you even suspected the issue without seeing the import statements
– Zeyad
Nov 25 '18 at 5:18