0
私は自分のデスクトップアプリケーションを作成するためにjavafxを使用しています。 Itriedが、私はこのエラーを取得しておく私のコードを実行するために -スレッド "JavaFX Application Thread"の例外java.lang.IllegalArgumentException
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.GeneratedMethodAccessor2.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(Unknown Source)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Node.fireEvent(Unknown Source)
at javafx.scene.control.Button.fire(Unknown Source)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$MouseHandler.process(Unknown Source)
at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$355(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
at com.sun.glass.ui.View.notifyMouse(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$149(Unknown Source)
at java.lang.Thread.run(Unknown Source)
私はdidntのは、私がSceneBuilderを使用し、FXMLファイルを書きました。
私のFXML -
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTextArea?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="neviTracker.ui.ScannerController">
<children>
<VBox prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: #ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox alignment="CENTER" prefHeight="56.0" prefWidth="600.0">
<children>
<Label text="Scanning" textAlignment="CENTER">
<font>
<Font name="System Bold Italic" size="29.0" />
</font>
</Label>
</children>
</HBox>
<HBox alignment="CENTER" prefHeight="53.0" prefWidth="575.0" spacing="5.0">
<children>
<VBox alignment="CENTER" prefHeight="53.0" prefWidth="109.0">
<children>
<ImageView fx:id="imgDownload" fitHeight="32.0" fitWidth="31.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Images/waiting_icon.png" />
</image>
</ImageView>
<Label text="Download Images">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="53.0" prefWidth="109.0">
<children>
<ImageView fx:id="imgProccessing" fitHeight="32.0" fitWidth="31.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Images/waiting_icon.png" />
</image>
</ImageView>
<Label text="Processing">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="53.0" prefWidth="109.0">
<children>
<ImageView fx:id="imgClassify" fitHeight="32.0" fitWidth="31.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Images/waiting_icon.png" />
</image>
</ImageView>
<Label text="Classfiy">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="59.0" prefWidth="115.0">
<children>
<ImageView fx:id="imgDifference" fitHeight="32.0" fitWidth="31.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Images/waiting_icon.png" />
</image>
</ImageView>
<Label text="Check for difference">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="53.0" prefWidth="109.0">
<children>
<ImageView fx:id="imgFinal" fitHeight="32.0" fitWidth="31.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Images/waiting_icon.png" />
</image>
</ImageView>
<Label text="Final steps">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</VBox>
</children>
</HBox>
<ScrollPane prefHeight="250.0" prefWidth="600.0">
<content>
<JFXTextArea fx:id="txtProgress" maxWidth="594.0" minWidth="585.0" prefHeight="242.0" prefWidth="585.0" />
</content>
</ScrollPane>
<HBox alignment="CENTER" prefHeight="40.0" prefWidth="600.0" spacing="20.0">
<children>
<JFXButton fx:id="btnStartScanning" buttonType="RAISED" onAction="#handleStartButton" prefWidth="80.0" ripplerFill="WHITE" style="-fx-background-color: #408ea8;" text="Start" textFill="WHITE" />
<JFXButton fx:id="btnStopScanning" buttonType="RAISED" onAction="#handleStopButton" prefWidth="80.0" ripplerFill="WHITE" style="-fx-background-color: #408ea8;" text="Cancel" textFill="WHITE" />
</children>
</HBox>
</children>
</VBox>
</children>
</AnchorPane>
とコードは、このFXMLをbehoynd -
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXTextArea;
import emuns.ImageStatus;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import utils.Constants;
public class ScannerController implements Initializable {
@FXML
private ImageView imgDownload;
@FXML
private ImageView imgProccessing;
@FXML
private ImageView imgClassify;
@FXML
private ImageView imgDifference;
@FXML
private ImageView imgFinal;
@FXML
private JFXTextArea txtProgress;
@FXML
private JFXButton btnStartScanning;
@FXML
private JFXButton btnStopScanning;
Map<String, ImageView> mapping = new HashMap<>();
@FXML private FXMLDrawerController drawerController;
public ScannerController() {
}
@Override
public void initialize(URL location, ResourceBundle resources) {
mapping.put("Downloading", imgDownload);
mapping.put("Processing", imgProccessing);
mapping.put("Classify", imgClassify);
mapping.put("Differance", imgDifference);
mapping.put("Final", imgFinal);
}
public void setDrawerController(FXMLDrawerController drawerController) {
this.drawerController = drawerController;
}
@FXML
void handleStartButton(MouseEvent event) {
drawerController.startScanning();
}
@FXML
void handleStopButton(MouseEvent event) {
drawerController.startScanning();
}
}
誰かが問題を見て、私を助けることができますか? 私の問題を解決する方法がわかりません。私はいつも私のアドバイスを与えることができますか? TNX
それdidntの仕事... .Iは、実行時例外を取得 - java.lang.RuntimeException: –
にjava.lang.reflect.InvocationTargetException @DanaSが含まれるようにあなたの質問を更新します新しいスタックトレース。おそらくあなたはAWFのものではなく、JavaFX 'ActionEvent'を使用しています... –
Tnx @James_Dそれは動作します!私は、AWTの... IMX import ActionEventを見たことがありませんでした。もう一度TNX! –