[英]Getting error - Exception in thread “AWT-EventQueue-0” java.lang.IllegalArgumentException: text cannot be null or empty
Trying to use Text Area to send String to IBM Watson. 尝试使用文本区域将字符串发送到IBM Watson。
Could do this by hard coding String. 可以通过对String进行硬编码来做到这一点。 I want to be able to input my own text in JTextArea.
我希望能够在JTextArea中输入自己的文本。
Move String text = textArea.getText();
移动
String text = textArea.getText();
inside the actionPerformed
method like this: 在
actionPerformed
方法内部,如下所示:
public void actionPerformed(ActionEvent e) {
String text = textArea.getText();
Profile profile = service.getProfile(text).execute();
System.out.println(profile);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.