import
java.awt.*;
import
java.awt.Event.*;
import
java.awt.event.ActionEvent;
import
java.awt.event.ActionListener;
import
javax.swing.*;
import
javax.swing.event.*;
public
class
Read
extends
JFrame{
private
JTextField addressBar;
private
JEditorPane display;
//constructor
public
Read(){
super("New
Browser");
addressBar
= new
JTextField("enter a URL!");
addressBar.addActionListener(
new
ActionListener(){ → 當你從鍵盤輸入
Enter
public
void
actionPerformed(ActionEvent event){
loadCrap(event.getActionCommand());
→ 從JTextField獲得String
}
}
);
}
}
沒有留言:
張貼留言