如何在文字栏位中输入字元

时间:2018-09-12 15:35:38

标签: javafx input character textfield

C:\Development\stack>javap -v MyClass.class
Classfile /C:/Development/stack/MyClass.class
  Last modified 12-Sep-2018; size 172 bytes
  MD5 checksum 9ca4a6c712dadb0bedeede816c57c1b4
  Compiled from "MyClass.java"
public interface MyClass
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
Constant pool:
   #1 = Class              #9             // MyClass
   #2 = Class              #10            // java/lang/Object
   #3 = Utf8               SourceFile
   #4 = Utf8               MyClass.java
   #5 = Utf8               RuntimeVisibleAnnotations
   #6 = Utf8               LMyAnnot;
   #7 = Utf8               value
   #8 = Utf8               somevalue
   #9 = Utf8               MyClass
  #10 = Utf8               java/lang/Object
{
}
SourceFile: "MyClass.java"
RuntimeVisibleAnnotations:
  0: #6(#7=s#8)

上面的代码片段产生以下编译时错误:

@FXML
public void handleAddButtonOnClick(ActionEvent actionEvent){

    String input = AddTextField.getText();
    try{
        System.out.println(hangman.check(input));
    }catch (Exception IO){
        System.out.println("ERROR: input is not character");
    }

}

如何修复它,以便可以在其中输入字符?

这是我的check(char) in Hangman cannot be applied to(java.lang.String) 方法

check

0 个答案:

没有答案