我只是想知道如何将单独的 NsLookup 程序的输出放入我的 NsLookupGUI 程序中的 TextArea 中?
我有一个 ActionListener;
private class buttonPressed implements ActionListener {
public void actionPerformed(ActionEvent a) {
getText = userInputBox.getText();
lookup.resolve(getText);
results.append(getText + "\n");
}
调用 Nslookup 类。但是,输出显示在终端而不是 TextArea 中。
下面这段代码是我的 NsLookup 程序;
public class NsLookup {
private InetAddress iNet = null;
public void resolve(String hostName) {
try {
iNet = InetAddress.getByName(hostName);
System.out.println("Host Name: " + iNet.getHostName());
System.out.println("IP Address is: " + iNet.getHostAddress());
}
提前致谢!