方法 .getText(); 不起作用,paramContext() 也不起作用;
基本上我需要输入大量文本(所以我使用了TextArea,因为TextField不够大),然后我需要将该信息存储在一个字符串中。所以我可以操纵它。
我是否可以将其保留为 textArea 类型?并且仍然从中提取单词和短语?
继承人的代码:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Scanner;
import java.io.*;
public class EmailExtractionGUI extends EasyApp
{
private TextArea emailInput = new TextArea("", 0,0, TextArea.SCROLLBARS_VERTICAL_ONLY);
public static void main(String[] args)
{
new EmailExtractionGUI();
}
//Left,Height position,width,height
Label passwordEntry = addLabel("Email Extraction Programme", 200,50,350,30,this);
//TextArea emailInput = addTextArea("",75,100,600,550,this);
Button bGo = addButton("Go",650,680,65,30,this);
Button bReset = addButton("Reset",575,680,65,30,this);
public EmailExtractionGUI()
{
setSize(750,750);
setTitle("Email Extraction");
setBackground(Color.white);
Font Andalus = new Font("Andalus", 3, 24);// 1st number here 1=bold, 2=italics,3=bold&italics, 0=norm
passwordEntry.setForeground(Color.blue);
passwordEntry.setFont(Andalus);
emailInput.setBackground(Color.white);
}
public void actions(Object source, String command)
{
if (source == bGo)
{
String emailText = emailInput.getText();
// Emails email = new Emails(emailText);
System.out.println(emailText);
}
提前致谢!