Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
798 B

  1. import java.awt.*;
  2. import java.awt.event.*;
  3. //
  4. //
  5. // NameDialog-
  6. // This Class is used to obtain the login name -i.e. the local queue name.
  7. //
  8. //
  9. public class NameDlg extends Dialog implements ActionListener
  10. {
  11. TextField name;
  12. Button login;
  13. public NameDlg(Frame frame, String prompt, String buttonText)
  14. {
  15. super(frame, prompt, true);
  16. enableEvents(AWTEvent.WINDOW_EVENT_MASK);
  17. setLayout(new FlowLayout());
  18. name = new TextField(25);
  19. login = new Button(buttonText);
  20. login.addActionListener(this);
  21. add(name);
  22. add(login);
  23. }
  24. public void actionPerformed(ActionEvent e)
  25. {
  26. hide();
  27. }
  28. public String getName()
  29. {
  30. return name.getText();
  31. }
  32. public void processWindowEvent(WindowEvent e)
  33. {
  34. if(e.getID() == e.WINDOW_CLOSING)
  35. {
  36. name.setText("");
  37. hide();
  38. }
  39. }
  40. }