Java Reference
In-Depth Information
if ( searchForLabel . equals ( "Network" )) {
category = Whois . SearchFor . NETWORK ;
} else if ( searchForLabel . equals ( "Person" )) {
category = Whois . SearchFor . PERSON ;
} else if ( searchForLabel . equals ( "Host" )) {
category = Whois . SearchFor . HOST ;
} else if ( searchForLabel . equals ( "Domain" )) {
category = Whois . SearchFor . DOMAIN ;
} else if ( searchForLabel . equals ( "Organization" )) {
category = Whois . SearchFor . ORGANIZATION ;
} else if ( searchForLabel . equals ( "Group" )) {
category = Whois . SearchFor . GROUP ;
} else if ( searchForLabel . equals ( "Gateway" )) {
category = Whois . SearchFor . GATEWAY ;
} else if ( searchForLabel . equals ( "ASN" )) {
category = Whois . SearchFor . ASN ;
}
server . setHost ( chosenServer . getText ());
return server . lookUpNames ( searchString . getText (),
category , group , exactMatch . isSelected ());
}
@Override
protected void done () {
try {
names . setText ( get ());
} catch ( Exception ex ) {
JOptionPane . showMessageDialog ( WhoisGUI . this ,
ex . getMessage (), "Lookup Failed" , JOptionPane . ERROR_MESSAGE );
}
}
}
public static void main ( String [] args ) {
try {
Whois server = new Whois ();
WhoisGUI a = new WhoisGUI ( server );
a . setDefaultCloseOperation ( WindowConstants . EXIT_ON_CLOSE );
a . pack ();
EventQueue . invokeLater ( new FrameShower ( a ));
} catch ( UnknownHostException ex ) {
JOptionPane . showMessageDialog ( null , "Could not locate default host "
+ Whois . DEFAULT_HOST , "Error" , JOptionPane . ERROR_MESSAGE );
}
}
private static class FrameShower implements Runnable {
private final Frame frame ;
FrameShower ( Frame frame ) {
Search WWH ::




Custom Search