示例#1
0
  /**
   * Gets contact from view.
   *
   * @return a Contact
   */
  public Contact getContact() {
    Contact c = new Contact(personView.get());
    c.setAddress(getAddress());
    c.setTele(getTele());
    c.setEmail(getEmail());
    c.setWebSites(getSites());

    return c;
  }
示例#2
0
 public void action() {
   Contact contact = new Contact();
   String name, phone;
   name = JOptionPane.showInputDialog("Ange namn");
   contact.setName(name);
   phone = JOptionPane.showInputDialog("Ange hemtelefon");
   contact.setPhone(phone);
   contact.setMobile(JOptionPane.showInputDialog("Ange mobil"));
   contact.setEmail(JOptionPane.showInputDialog("Ange mail-adress"));
   JOptionPane.showMessageDialog(null, contact.toString());
   JOptionPane.showMessageDialog(
       null,
       contact.getName()
           + "\n"
           + contact.getPhone()
           + "\n"
           + contact.getMobile()
           + "\n"
           + contact.getEmail());
 }