我'使用SceneBuilder创建一个Java FX项目,当我试图处理onHiding和onHidden for fx日期选择器时,我遇到了争论类型不匹配(最后的异常消息)。
我已经在这里查看了答案:JavaFx Event argument type mismatch。
第一个解决方案对我不起作用,因为我需要在隐藏过程中和之后执行操作。我尝试了第二种解决方案,并且根据我的怀疑,它也没有起作用。
以下是FXML控制器:
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXCheckBox;
import com.jfoenix.controls.JFXDatePicker;
import com.jfoenix.controls.JFXRadioButton;
import com.jfoenix.controls.JFXTextField;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ToggleGroup;
public class EditActionWindowController {
private Task task = null;
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
private JFXTextField txtfName;
@FXML
private JFXRadioButton radUrgent;
@FXML
private ToggleGroup priorityGroup;
@FXML
private JFXRadioButton radCurrent;
@FXML
private JFXRadioButton radEventual;
@FXML
private JFXRadioButton radInactive;
@FXML
private JFXCheckBox chkbUrgent;
@FXML
private JFXCheckBox chkbCurrent;
@FXML
private JFXDatePicker currentDatePicker;
@FXML
private JFXDatePicker urgentDatePicker;
@FXML
private JFXCheckBox chkbEventual;
@FXML
private JFXDatePicker eventualDatePicker;
@FXML
private JFXButton btnComment;
@FXML
private JFXButton btnHistory;
@FXML
private JFXButton btnPrint;
@FXML
private JFXButton btnClose;
@FXML
void btnCommentAction(ActionEvent event) {
}
@FXML
void btnHistoryOnAction(ActionEvent event) {
}
@FXML
void btnPrintOnAction(ActionEvent event) {
}
@FXML
void chkbCurrentAction(ActionEvent event) {
}
@FXML
void chkbEventualAction(ActionEvent event) {
}
@FXML
void chkbUrgentAction(ActionEvent event) {
}
@FXML
void currentDatePickerOnHidden(ActionEvent event) {
}
@FXML
void currentDatePickerOnHiding(ActionEvent event) {
}
@FXML
void eventualDatePickerOnHidden(ActionEvent event) {
}
@FXML
void eventualDatePickerOnHiding(ActionEvent event) {
}
@FXML
void radCurrentAction(ActionEvent event) {
}
@FXML
void radEventualAction(ActionEvent event) {
}
@FXML
void radInactiveAction(ActionEvent event) {
}
@FXML
void radUrgentAction(ActionEvent event) {
}
@FXML
void urgentDatePickerOnHidden(ActionEvent event) {
}
@FXML
void urgentDatePickerOnHiding(ActionEvent event) {
}
}
这里是SceneBuilder生成的FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXCheckBox?>
<?import com.jfoenix.controls.JFXDatePicker?>
<?import com.jfoenix.controls.JFXRadioButton?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.shape.Rectangle?>
<ScrollPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="460.0" prefWidth="795.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="frontend.EditActionWindowController">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="449.0" prefWidth="781.0">
<children>
<JFXTextField fx:id="txtfName" focusColor="#315de4" labelFloat="true" layoutX="48.0" layoutY="32.0" prefHeight="35.0" prefWidth="372.0" promptText="Name" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#c6c8c9" height="29.0" layoutX="584.0" layoutY="89.0" opacity="0.32" stroke="#0004f8" strokeType="INSIDE" width="130.0" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#c6c8c9" height="29.0" layoutX="584.0" layoutY="131.0" opacity="0.32" stroke="#0004f8" strokeType="INSIDE" width="130.0" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#c6c8c9" height="29.0" layoutX="585.0" layoutY="168.0" opacity="0.32" stroke="#0004f8" strokeType="INSIDE" width="130.0" />
<JFXRadioButton fx:id="radUrgent" layoutX="48.0" layoutY="103.0" onAction="#radUrgentAction" text="Urgent">
<toggleGroup>
<ToggleGroup fx:id="priorityGroup" />
</toggleGroup>
</JFXRadioButton>
<JFXRadioButton fx:id="radCurrent" layoutX="48.0" layoutY="128.0" onAction="#radCurrentAction" text="Current" toggleGroup="$priorityGroup" />
<JFXRadioButton fx:id="radEventual" layoutX="48.0" layoutY="151.0" onAction="#radEventualAction" text="Eventual" toggleGroup="$priorityGroup" />
<JFXRadioButton fx:id="radInactive" layoutX="48.0" layoutY="174.0" onAction="#radInactiveAction" text="Inactive" toggleGroup="$priorityGroup" />
<JFXCheckBox fx:id="chkbUrgent" checkedColor="#10859c" layoutX="47.0" layoutY="271.0" onAction="#chkbUrgentAction" text="Elevates to Urgent on:" />
<JFXCheckBox fx:id="chkbCurrent" checkedColor="#10859c" layoutX="48.0" layoutY="313.0" onAction="#chkbCurrentAction" text="Elevates to Current on:" />
<JFXDatePicker fx:id="currentDatePicker" defaultColor="#08008f" editable="false" layoutX="209.0" layoutY="306.0" onHidden="#currentDatePickerOnHidden" onHiding="#currentDatePickerOnHiding" prefHeight="32.0" prefWidth="201.0" promptText="Task becomes Current on..." />
<JFXDatePicker fx:id="urgentDatePicker" editable="false" layoutX="209.0" layoutY="266.0" onHidden="#urgentDatePickerOnHidden" onHiding="#urgentDatePickerOnHiding" prefHeight="32.0" prefWidth="200.0" promptText="Task becomes Urgent on..." />
<JFXCheckBox fx:id="chkbEventual" layoutX="48.0" layoutY="353.0" onAction="#chkbEventualAction" text="Elevates to Eventual on:" />
<JFXDatePicker fx:id="eventualDatePicker" editable="false" layoutX="216.0" layoutY="348.0" onHidden="#eventualDatePickerOnHidden" onHiding="#eventualDatePickerOnHiding" prefHeight="28.0" prefWidth="196.0" promptText="Task becomes Eventual on..." />
<JFXButton fx:id="btnComment" buttonType="RAISED" layoutX="584.0" layoutY="88.0" onAction="#btnCommentAction" prefHeight="30.0" prefWidth="130.0" ripplerFill="#0040ff" text="Comment" />
<JFXButton fx:id="btnHistory" buttonType="RAISED" layoutX="584.0" layoutY="131.0" onAction="#btnHistoryOnAction" prefHeight="29.0" prefWidth="129.0" text="History" />
<JFXButton fx:id="btnPrint" buttonType="RAISED" layoutX="586.0" layoutY="168.0" onAction="#btnPrintOnAction" prefHeight="29.0" prefWidth="129.0" text="Print" />
<JFXButton fx:id="btnClose" cancelButton="true" layoutX="641.0" layoutY="368.0" text="Close" visible="false" />
</children></AnchorPane>
</content>
</ScrollPane>
以下是例外消息:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
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.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.control.ComboBoxBase.setShowing(ComboBoxBase.java:183)
at javafx.scene.control.ComboBoxBase.hide(ComboBoxBase.java:400)
at com.jfoenix.skins.JFXDatePickerSkin.syncWithAutoUpdate(JFXDatePickerSkin.java:241)
at com.jfoenix.controls.behavior.JFXDatePickerBehavior.onAutoHide(JFXDatePickerBehavior.java:66)
at com.sun.javafx.scene.control.skin.ComboBoxPopupControl.lambda$createPopup$294(ComboBoxPopupControl.java:253)
at javafx.stage.PopupWindow.doAutoHide(PopupWindow.java:840)
at javafx.stage.PopupWindow$PopupEventRedirector.handleAutoHidingEvents(PopupWindow.java:1025)
at javafx.stage.PopupWindow$PopupEventRedirector.handleRedirectedEvent(PopupWindow.java:967)
at com.sun.javafx.event.EventRedirector.dispatchCapturingEvent(EventRedirector.java:106)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
at com.sun.javafx.event.EventRedirector.redirectEvent(EventRedirector.java:124)
at com.sun.javafx.event.EventRedirector.dispatchCapturingEvent(EventRedirector.java:103)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
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.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:381)
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$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
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._enterNestedEventLoopImpl(Native Method)
at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:218)
at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511)
at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:583)
at javafx.stage.Stage.showAndWait(Stage.java:474)
at frontend.EditActionWindow.<init>(EditActionWindow.java:34)
at MainController$2.handle(MainController.java:277)
at MainController$2.handle(MainController.java:1)
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.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$ClickGenerator.postProcess(Scene.java:3470)
at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
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:381)
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$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
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$148(WinApplication.java:191)
at java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.Trampoline.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
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.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.control.ComboBoxBase.setShowing(ComboBoxBase.java:183)
at javafx.scene.control.ComboBoxBase.hide(ComboBoxBase.java:400)
at com.sun.javafx.scene.control.skin.ComboBoxBaseSkin.focusLost(ComboBoxBaseSkin.java:99)
at com.sun.javafx.scene.control.skin.ComboBoxBaseSkin.lambda$new$290(ComboBoxBaseSkin.java:87)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72)
at javafx.scene.Node$FocusedProperty.notifyListeners(Node.java:7720)
at javafx.scene.Node.setFocused(Node.java:7773)
at javafx.scene.Scene$KeyHandler.setWindowFocused(Scene.java:3932)
at javafx.scene.Scene$KeyHandler.lambda$new$11(Scene.java:3954)
at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72)
at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
at javafx.stage.Window.setFocused(Window.java:439)
at com.sun.javafx.stage.WindowPeerListener.changedFocused(WindowPeerListener.java:59)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:100)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:40)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.lambda$handleWindowEvent$423(GlassWindowEventHandler.java:150)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:148)
at com.sun.glass.ui.Window.handleWindowEvent(Window.java:1266)
at com.sun.glass.ui.Window.notifyFocus(Window.java:1245)
at com.sun.glass.ui.win.WinWindow._requestFocus(Native Method)
at com.sun.glass.ui.Window.requestFocus(Window.java:727)
at com.sun.glass.ui.Window.requestFocus(Window.java:732)
at com.sun.javafx.tk.quantum.WindowStage.requestToFront(WindowStage.java:875)
at com.sun.javafx.tk.quantum.WindowStage.setPlatformEnabled(WindowStage.java:844)
at com.sun.javafx.tk.quantum.WindowStage.setEnabled(WindowStage.java:863)
at com.sun.javafx.tk.quantum.WindowStage.setVisible(WindowStage.java:485)
at javafx.stage.Window$9.invalidated(Window.java:872)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
at javafx.stage.Window.setShowing(Window.java:922)
at javafx.stage.Window.hide(Window.java:947)
at com.sun.javafx.stage.WindowCloseRequestHandler.dispatchBubblingEvent(WindowCloseRequestHandler.java:45)
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.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at com.sun.javafx.stage.WindowPeerListener.closing(WindowPeerListener.java:88)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:121)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:40)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.lambda$handleWindowEvent$423(GlassWindowEventHandler.java:150)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:148)
at com.sun.glass.ui.Window.handleWindowEvent(Window.java:1266)
at com.sun.glass.ui.Window.notifyClose(Window.java:1174)
at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:218)
at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:511)
at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:583)
at javafx.stage.Stage.showAndWait(Stage.java:474)
at frontend.EditActionWindow.<init>(EditActionWindow.java:34)
at MainController$2.handle(MainController.java:277)
at MainController$2.handle(MainController.java:1)
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.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$ClickGenerator.postProcess(Scene.java:3470)
at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
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:381)
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$354(GlassViewEventHandler.java:417)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
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$148(WinApplication.java:191)
at java.lang.Thread.run(Unknown Source)
我的理解是onHiding处理程序和日期选择器的onHidden处理程序抛出了参数不匹配异常。非常感谢帮助。
答案 0 :(得分:0)
onHidden
和onHiding
属性为EventHandler<Event>
,而不是EventHandler<ActionEvent>
。因此,传递给处理程序方法的参数是Event
的实例。当FXMLLoader
检查您指定的方法时,它会看到参数类型为ActionEvent
,因此会抛出异常。
只需将onHidden
和onHiding
处理程序方法的参数类型更改为Event
:
@FXML
void currentDatePickerOnHidden(Event event) {
}
@FXML
void currentDatePickerOnHiding(Event event) {
}
@FXML
void eventualDatePickerOnHidden(Event event) {
}
@FXML
void eventualDatePickerOnHiding(Event event) {
}