FileDocCategorySizeDatePackage
DateApplet.javaAPI DocExample958Fri Sep 01 14:24:12 BST 2000darwinsys.distdate

DateApplet

public class DateApplet extends Applet

Fields Summary
RemoteDate
netConn
Button
b
Label
statusLabel
Constructors Summary
Methods Summary
public voidinit()


	   
		try {
			netConn = (RemoteDate)Naming.lookup(RemoteDate.LOOKUPNAME);
		} catch (Exception e) {
			System.err.println("RemoteDate exception: " + e.getMessage());
			e.printStackTrace();
		}
		add(b = new Button("Get Date"));
		b.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				if (netConn == null) {
					showStatus("Connection failed, bye");
					return;
				}
				try {
					Date today = netConn.getRemoteDate();
					showStatus(today.toString()); // XX use a DateFormat...
				} catch (Exception ex) {
					System.err.println("RemoteDate exception: " + ex.getMessage());
					showStatus("RemoteDate failed, see Java Console");
				}
			}
		});