Java Reference
In-Depth Information
public class WhoisGUI extends JFrame {
private JTextField searchString = new JTextField ( 30 );
private JTextArea names = new JTextArea ( 15 , 80 );
private JButton findButton = new JButton ( "Find" );;
private ButtonGroup searchIn = new ButtonGroup ();
private ButtonGroup searchFor = new ButtonGroup ();
private JCheckBox exactMatch = new JCheckBox ( "Exact Match" , true );
private JTextField chosenServer = new JTextField ();
private Whois server ;
public WhoisGUI ( Whois whois ) {
super ( "Whois" );
this . server = whois ;
Container pane = this . getContentPane ();
Font f = new Font ( "Monospaced" , Font . PLAIN , 12 );
names . setFont ( f );
names . setEditable ( false );
JPanel centerPanel = new JPanel ();
centerPanel . setLayout ( new GridLayout ( 1 , 1 , 10 , 10 ));
JScrollPane jsp = new JScrollPane ( names );
centerPanel . add ( jsp );
pane . add ( "Center" , centerPanel );
// You don't want the buttons in the south and north
// to fill the entire sections so add Panels there
// and use FlowLayouts in the Panel
JPanel northPanel = new JPanel ();
JPanel northPanelTop = new JPanel ();
northPanelTop . setLayout ( new FlowLayout ( FlowLayout . LEFT ));
northPanelTop . add ( new JLabel ( "Whois: " ));
northPanelTop . add ( "North" , searchString );
northPanelTop . add ( exactMatch );
northPanelTop . add ( findButton );
northPanel . setLayout ( new BorderLayout ( 2 , 1 ));
northPanel . add ( "North" , northPanelTop );
JPanel northPanelBottom = new JPanel ();
northPanelBottom . setLayout ( new GridLayout ( 1 , 3 , 5 , 5 ));
northPanelBottom . add ( initRecordType ());
northPanelBottom . add ( initSearchFields ());
northPanelBottom . add ( initServerChoice ());
northPanel . add ( "Center" , northPanelBottom );
pane . add ( "North" , northPanel );
ActionListener al = new LookupNames ();
findButton . addActionListener ( al );
searchString . addActionListener ( al );
}
Search WWH ::




Custom Search