Java Reference
In-Depth Information
protected
protected BufferedReader iis ;
/** This inner class is the action handler both for pressing
* the "Try" button and also for pressing <ENTER> in the text
* field. It gets the IP name/address from the text field
* and passes it to process() in the main class. Run in the
* GUI Dispatch thread to avoid messing the GUI. -- tmurtagh.
*/
final
final ActionListener runner ;
/** Construct a GUI and some I/O plumbing to get the output
* of "TestOpenMailRelay" into the "results" textfield.
*/
public
public CheckOpenMailRelayGui () throws
throws IOException {
super
super ( "Tests for Open Mail Relays" );
runner = new
new ActionListener () {
public
public void
void actionPerformed ( ActionEvent evt ) {
goButton . setEnabled ( false
false );
SwingUtilities . invokeLater ( new
new Runnable () {
public
public void
void run () {
String host = hostTextField . getText (). trim ();
out . println ( "Trying " + host );
CheckOpenMailRelay . process ( host , out );
goButton . setEnabled ( true
true );
}
});
}
};
JPanel p ;
Container cp = getContentPane ();
cp . add ( BorderLayout . NORTH , p = new
new JPanel ());
// The entry label and text field.
p . add ( new
new JLabel ( "Host:" ));
p . add ( hostTextField = new
new JTextField ( 10 ));
hostTextField . addActionListener ( runner );
p . add ( goButton = new
new JButton ( "Try" ));
goButton . addActionListener ( runner );
JButton cb ;
p . add ( cb = new
new JButton ( "Clear Log" ));
cb . addActionListener ( new
new ActionListener () {
public
public void
void actionPerformed ( ActionEvent evt ) {
results . setText ( "" );
Search WWH ::




Custom Search