Address book: inputting spouses

What is the best way to list a spouse? I want the name to appear when printing labels. such as:
John Smith
Jane Robinson
2 Something street
What i do now is this:
For first name I input John
For last name I input "Smith and Jane Robinson"
i'd prefer a separate line, because when I synch with anything (like blackberry) I have to see her name anytime i call up John Smith. I've tried putting the spouse under company, but i can't get it to print in labels.
Any advice?

There is an alternative that will give you another field to input names etc. open the address book, then go into Address Book/preferences.Template Tab, then go to add field, and if you were to choose nickname for example, you will be able to input another line.
Hope this helps.

Similar Messages

  • Syncing pocket mac and Imac address book inputs double contacts in bb curve

    Why when i sync my bb am i getting double contacts in my bb when syncing with my address book on my Imac.  the only time it doesnt if I overide the deviceoption.  If Im out and add a contact and want to sync both ways this is when it seems to add double contacts to my bb.

    I have the same problem.
    Additionally, the Groups of contacts of my Apple AB is not converted to the Goups of contacts in Gmail.

  • How can I edit address labels from my address book to add spouse name?

    Address book supports Spouse/partner/friend name but the label printing function of address book does not seem to and I can't see how to save a version that I can edit to manually add the missing partners. It only seems to allow me to print it as it is. What can I do? I also just bought Pages in the hopes of helping print christmas letter address labels but haven't figured it out yet

    Warren: looking at other threads out there it doesn't appear that you can print the spouse/partner/friend field. One poster suggested using Avery DesignPro for Mac, which merges with your AddressBook, and allows you to select which fields to include.  The only caveat is that it doesn't show it working with Lion (os 10.7).  You can download it here:
    http://www.avery.com/avery/en_us/Templates-%26-Software/Avery-DesignPro-for-Mac. htm?N=0&refchannel=c042fd03ab30a110VgnVCM1000002118140aRCRD
    Hope this helps.
    -McCArch
    (also posted this in the other thread where you asked a similar question)

  • I would like to add a new card date field to my address Book Contacts. Is this possible? Thanks, Jeff

    Hi,
    I would like to add a new card date field to my Address Book Contacts. Is there any way to do this? I have a lot of contacts and it helps me remember who I talked to, if I had a new card date field in my contacts.
    Thank you,
    Jeff

    Hi,
    I found the applescript below from Michael Bach that works well.
    (* Find recently modified entries in the Address Book
    Input: a time interval (backwards from today) in the variable "daysBeforeToday"
    Output: a string on the clipboard, format: YYYY-MM-DD (tab) Name (return)
    ©2009, Michael Bach, <www.michaelbach.de> *)
    set daysBeforeToday to 7 -- <<<  change as desired or read from a dialog
    tell application "Address Book"
      copy (current date) - daysBeforeToday * 24 * minutes * 60 to referenceDate
      copy (every person whose (modification date > referenceDate)) to modifiedPersons
      set s to ""
      repeat with aPerson in modifiedPersons
        set d to ((modification date) of aPerson) -- now change to international format and forget the hours
        set dateString to (year of d as string) & "-" & (my twoDigits((month of d) as number)) & "-" & (my twoDigits(day of d) as string)
        set s to s & dateString & tab & (name of aPerson) & return
      end repeat
      set the clipboard to s --for pasting into other applications
      s -- to view immediately in the script editor
    end tell
    on twoDigits(aNumber) -- trivial utility for formatting
      if aNumber < 10 then return "0" & (aNumber as string)
      return (aNumber as string)
    end twoDigits
    I changed the modification date to creation date.
    Thanks for the replies.

  • Address Book/iPhone Sync of custom fields

    Why doesn't my iPod Touch (which is all set up to sync with my Mobile Me account) sync the custom fields that are set up in my Address Book?
    They show up when I log onto Me.com and look in the Address Book from online. So I know that the Mobile Me "cloud" is accepting the custom fields. Why doesn't my iPod Touch sync them? All the other fields sync up just fine.

    Closely related question:
    The "Related Names" field has always been available in the computer version of Address Book. (Spouse, Child, Assistant, Parent, etc.) This is a VERY useful field, and its absence in the iPhone version of the application is extremely annoying. In fact, it would be even more useful on the phone than on the computer. (e.g., I'm talking to someone and I can't remember his wife's name, so I pull out my iPhone to look this up -- AND IT'S NOT THERE BECAUSE THE FIELD IS NOT AVAILABLE ON THE iPHONE!) And as you mentioned, it's one of the fields that DO appear in the online cloud version of MobileMe Contacts.
    I cannot imagine any valid reason for this not having been included. There are lots of similar fields that do appear on the iPhone that have multiple choices for the label (phone, email, etc. all provide a drop-down choice as to the label, just like the related names field).
    So, Apple People if you are listening: Was this omission simply an unfortunate oversight? Are there any plans to fix this? I keep waiting for such an obvious omission to be fixed with each iPhone software update, but this has not happened.
    Thanks for any wisdom on this!
    Steve

  • Address Book Exporting ... the Case of the Missing Spouse ... ?

    … and missing children and missing birthdays, too.
    I have had problems customizing address labels, which I discussed in detail in a separate message, entitled Wonky Address Labels. In fact, I gave up on using Apple Address Book and decided to export the database, put it in Excel, and do some column merging to get a one-time solution to my label-printing problem for my Christmas cards.
    Yeah, sure I would … when Address Book will not export in anything other than an arcane address book file format.
    So it was back to this forum, to review exporting suggestions. Two seemed to be offered and I tried ‘em both; first, Address Book Exporter at:
    gwenhiver.net/applications/addressbookexporter/index.php
    and second, some special mail scripts at:
    http://homepage.mac.com/aamann/Mail_Scripts.html
    These were both fun to use and worked pretty well, producing tab-delimited text files. But neither will do a complete export of the database; they won’t export spouse names, anniversary dates, children’s names or spouse/children’s birthdays ( which I had put in an ‘Other Date’ field ) … nor, BTW, will they export custom fields.
    Well, if I can’t print custom labels with Apple Address Book and can’t export the full database, I guess hand-written Christmas card envelopes have a certain panache.
    Or, I suppose I might use my 10-year old Windows software that I run on Virtual PC.
    It would be nice if Apple would fix this Address Book exporting problem. Frankly, I don’t like the idea of having data in a database that I cannot export as a simple text file. In fact, if I had known I could not get my data OUT, I would not have put it IN to start with.
    Any suggestions for exporting ALL the fields of the Apple Address Book database would be welcome.
    DICK

    value = value;Oh, so you have one of those new compilers that reads your mind and knows which value is which in that statement, huh?
    Lucky.
    The rest of us are stuck doing this.value = value;so that the compiler can distinguish the member variable from the method parameter.

  • Can't input birthday previous to 2000 in address book

    The birthday field in address book won't let me input a date older than the year 2000.  I assume there's a way to change that but didn't find anything in the preferences menu. Can somebody help me?
    Thank you!

    It's probably that one of the addresses in the group is not correct e.g. something like myaddress&myisp.com instead of [email protected]

  • HT3952 Why can't Address Book allow me to add "spouse" to the print job?

    I can add "spouse" to a card, so why can't Address Book allow me to print the name on the card plus the spouse name? So if I try to print "Ravi" I have the option in the print dialogue to add "Mei"? Seems simple, even Word can do it.

    Hi,
    It doesn't look like the "Country" field on the cards need to match.  I changed one of the spouses to a different country and the label (as shown in the print dialogue panel as you suggested) still shows "John Smith and Jane Doe."  Most of my country fields are blank.
    It does matter that the Country Code be the same for both.  After selecting the card and clicking on edit, the Country Code can be checked or changed by clicking on the address label (home, work, etc.) and moving the mouse down to "Change Address Format..."  You'll see a long list of countries.  If the cards for Jane and John don't have the same country code, the label won't show both names.
    The lines of code like:
         <key>us</key>
         <true/>
    in the ABRelatedNamesConfig.plist file determine which countries the related names functionality will work in.  Using the plist shown in an earlier post, they need to live in ca (Canada), uk (United Kingdom), us (United States), or fr (France) and both need be be in the same one.  Adding other country codes to the plist file should enable that country to work as well (I haven't tried it).
    The related names functionality was removed with the release of Snow Leopard (10.6) so I've editied the plist file in 10.6, 10.7 and 10.8.  All have worked.
    The only other thing I noticed is that the following two lines shown in the earlier post are really one line in the plist file.
    As shown in the earlier post, the code:
         
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    is really all on one line.  Here is a screen shot of my plist file as viewed in TextWrangler:
    The good news is we have 358 days to figure this out before Christmas.
    Jay

  • ADDRESS BOOK: Envelopes print "assistants", "Spouse" &c

    I entered some names in "friend", "assistant" &c, in Address Book and these are being added to the main name when I print envelopes. How can I stop the programme doing this? Do I have to remove all the extra names?

    Huh! I had never noticed this, but I have the same problem ... on some contacts only. There doesn't seem to be a lot of logic to this: some contacts with "spouse" entries print out with first names separated by "and" plus last name, or with both full names separated by "and" if the last names are different ... but some don't. Weirder still, it doesn't seem to matter if each spouse has an individual listing or not. Plus, in some cases where each spouse has an individual "card" printing both results in one addressed to both & the other just to that person.
    I don't get it!

  • Since the debut of iCloud, I cannot add spouse, child etc... data to the address book.  Anyone have a clue how to get it back??

    Ever since iCloud went live, I cannot add any spouse, child etc... info to the address book.  Anyone have an idea how to get this back.  I tried to reset the template, looks like it has been removed.  I also de-selected the iCloud and selected on my local Mac in the accounts area in preferences. Still no luck. My address book entries prior to iCloud still have all the data and I'm able to modifiy if desired.  Any ideas??

    I copied this from an extremely knowledgable iTunes for Windows user in another discussion. Maybe this will help.
    In Windows, you can restore much of the look & feel of iTunes 10.7 with these shortcuts:
    ALT to temporarily display the menu bar
    CTRL+B to show or hide the menu bar
    CTRL+S to show or hide the sidebar
    CTRL+/ to show or hide the status bar (won't hide for me on Win XP)
    Click the magnifying glass top right and untick Search Entire Library to restore the old search behaviour
    Use View > Hide <Media Kind> in the cloud or Edit (iTunes) > Preferences > Store anduntick Show iTunes in the cloud purchases to hide the cloud items. The second method eliminates the cloud status column (and may let iTunes start up more quickly)
    If you don't like having different coloured background & text in the Album (Grid) view use Edit(iTunes) > Preferences > General and untick Use custom colours for open albums, movies, etc.
    With iTunes 11.0.3 you can enable artwork in the Songs and playlist views from View > Show View Options (CTRL+J) making it more like the old Album List view.
    If you are a Mac user, all you have to do is start navigating through the menu items at the top of the screen to find just about everything that is mentioned here.

  • Address Book Spouse strategies...

    Hey there,
    I need some ideas. We have a bunch of contacts in AB that are in the form "Frank & Estelle Costanza", where Frank & Estelle are in the first name. We've named them that way for the sake of printing Christmas labels, but typically, the email if for Frank only. So when we go to email Frank, we see "Frank & Estelle Costanza", instead of the preferred just Frank Costanza.
    I realize that I should probably just eliminate the spouse name in the First field, but that only takes care of the "one main person/spouse is just for Christmas cards" scenario, (but who knows what I'll have to do for holiday labels).
    What about the "2 married people that I need to email and call separately" scenario? Usually separate cell and/or work phones but common home phone and address. Multiple entries?
    Anyone have any real world solutions to this common issue?
    Thanks!

    Off hand, and I might be wrong, just build several difference address groups in Address Book. It's just a matter of creating the grouping and importing the names and addresses from Address Book.

  • HT2513 Had to import Birthdays from yahoo calendar. Is there any way to move them to the iCal Birthdays calendar without manually inputing them each into Address Book?

    I used to use Yahoo Calendar to manage my birthdays and notifications of them. Yahoo screwed with something, so now I no longer get birthday notification texts to my cell. Now, I've imported my Yahoo Calendar dates in to iCal. iCal has a Birthdays "subscription" calendar which only shows birthdays entered into the Address Book. I do not have any birthdays entered into Address Book. Is there any way to select birthday entries from my other calendars and move them to the birthdays tab, or must I manually enter over 200 birthdays into Address Book?
    While I'm here, is there any way to highlight specific calendar entries and move them to a "new calendar"?
    THanks in advance for any and all help.
    -BKTru

    looks like this is not yet an option via yahoo/sbc

  • Address Book contact preview shows a different date than what is input in the birthday field.

    When opening the address book and clicking on an entry, the preview pane at the bottom shows a different date than the date that is entered in the birthday field. It shows the day before the actual date that is entered. See images below:
    Thanks!

    Thunderbird numbering is based on the Extended Support Releases, which are provided every seven "regular" cycles (thus after 7 6-week cycles = every 42 weeks) to minimize fallout from new features hitting the releases to frequently. Initially, those release were issued to organizations only which require some kind of internal review or certification of software prior to deployment.
    Currently we are in the "37.0" cycle and 38 beta 1 has just been released (but doesn't have the fix yet). Meaning, the next release after 31.6.0 won't be 31.7.0 but 38.0 already, followed by 38.1.0 up to 38.6.0, the continuing with 45.0, etc.
    Confusing, yes, but that's what they came up with.

  • Address Book and Envelopes

    In previous versions I could print envelopes that would append the spouse name to the delivery address:
    Jane & John Doe
    111 Main St    
    Frustrationville IL
    It appears this is no longer supported.   Can anyone speak to some options?

    Not sure why your address book entries are not showing in the Widget, but you can change the work address to home. When you open address book and select the plus button to add a contact you will see the work address, directly to the right of Work you will see an up and down arrow on top of one another, select these arrows and you will see that you can change it to Home, Work, Other or Custom.
    Did you manually input all your contacts into the address book or did you migrate the from say Outlook?

  • Address book .... importing text file

    I am designing an address book which opens a text file called AddressBook.txt which reads in the information in the following format:
    lastname,firstname,street,city,state,zip,phonenumber,birthday,persontype
    lastname2,firstname2,street2,city2,state2,zip2,phonenumber2,birthday2,persontype2
    etc. (with a maximum entries of 500)
    I am having a problem reading in the information without the commas and wrapping to the next line. I can either use the BufferedReader or Scanner to input the file and as you can see below, my code is not complete yet. I can't figure out how to code the storeAddress() method in order to get the addressBookEntries[] to include the necessary information for outputting, sorting, etc. If I can get the information read into the addressBookEntries[], I think I will probably be able to proceed in the rest of the required tasks (i.e. sorting by last name, searching by last name, etc.)
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    *  @created September 14, 2004
    *  This program uses a JFrame to manipulate data and form an
    *  address book.  The user will be able to load data from a file,
    *  sort it by last name, print the address, phone number, and date
    *  of birth, print the names of people whos birthday are between 2
    *  dates, print the names of people between 2 last names, and/or
    *  print the names of different person types.
    public class AddressBook extends JPanel implements ActionListener{
        JFrame frame;
        final int numButtons = 7;
        JRadioButton[] radioButtons = new JRadioButton[numButtons];
        JButton process = new JButton("Process Request");
        JLabel title;
        JTextArea output = new JTextArea(30,50);
        int MAX_ADDRESS_ENTRIES = 500;
        AddressBookEntry addressBookEntries[] =
            new AddressBookEntry[MAX_ADDRESS_ENTRIES];
        String FILE_NAME="AddressBook.txt";
        public AddressBook(JFrame frame){
            super(new BorderLayout());
            this.frame=frame;
            JPanel choicePanel = createSimpleDialogBox();
            choicePanel.setBorder(BorderFactory.createTitledBorder("Choices" +
            " to choose from:"));
            title = new JLabel("<html><h2> Thank you for opening the " +
            "Address Book.  " +
            "Please Press the \"Process Request\" " +
            "after making a choice.</h2></html>\n",JLabel.CENTER);
            title.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
            output.setEditable(false);
            add(title, BorderLayout.NORTH);
            add(choicePanel, BorderLayout.CENTER);
            add(output, BorderLayout.SOUTH);
            final ButtonGroup group = new ButtonGroup();
            final String saveCommand = "Save";
            final String sortByLN = "Sort by Last Name";
            final String searchLNCommand = "Search By Last Name";
            final String printAPD = "Print address, phone number, and DOB";
            final String printNamesDOB = "Print names of people whose birthday" +
            " falls between 2 dates";
            final String printNamesLN = "Print names of people who fall" +
            " between 2 last names";
            final String printPType = "Print all family members, friends, or" +
            " business associates";
        private JPanel createSimpleDialogBox(){
            radioButtons[0] = new JRadioButton(
              "<html>Save the address file</html>");
            radioButtons[0].setActionCommand(saveCommand);
            radioButtons[1] = new JRadioButton(
              "<html>Sort the address file by last name</html>");
            radioButtons[1].setActionCommand(sortByLN);
            radioButtons[2] = new JRadioButton(
              "<html>Search the address file by last name</html>");
            radioButtons[2].setActionCommand(searchLNCommand);
            radioButtons[3] = new JRadioButton(
              "<html>Print the address, phone number, and DOB of a specified" +
              " person</html>");
            radioButtons[3].setActionCommand(printAPD);
            radioButtons[4] = new JRadioButton(
              "<html>Print the names of people whose birthday falls between" +
              " two dates</html>");
            radioButtons[4].setActionCommand(printNamesDOB);
            radioButtons[5] = new JRadioButton(
              "<html>Print the names of people who fall between two" +
              " specified last names</html>");
            radioButtons[5].setActionCommand(printNamesLN);
            radioButtons[6] = new JRadioButton(
              "<html>Print all family members, friends, <u>OR</u>" +
              " business associates</html>");
            radioButtons[6].setActionCommand(printPType);
            for (int i=0; i<numButtons; i++){
                group.add(radioButtons);
    //set the first button (open file) to be selected
    radioButtons[0].setSelected(true);
    return createPane(radioButtons, process);
    private JPanel createPane(JRadioButton[] radioButtons,
    JButton showButton) {
    int numChoices = radioButtons.length;
    JPanel box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
    for (int i = 0; i < numChoices; i++) {
    box.add(radioButtons[i]);
    JPanel pane = new JPanel(new BorderLayout());
    pane.add(box, BorderLayout.NORTH);
    pane.add(showButton, BorderLayout.SOUTH);
    return pane;
    public void actionPerformed(ActionEvent e) {
    String command = group.getSelection().getActionCommand();
    //else if button pushed is save
    if (command == saveCommand){
    // save file
    //else if button pushed is search by last name
    else if (command == sortByLN){
    // search by last name
    //else if button pushed is sort by last name
    else if (command == searchLNCommand){
    // sort by last name
    // print to screen
    //else if button pushed is display address, ph#, dob
    else if (command == printAPD){
    // display "search by last name" dialog
    // search last names
    // if last name found
    // print data
    // else
    // print error notification "person not found"
    //else if button pushed is list names of people whose
    //bday between 2 days
    else if (command == printNamesDOB){
    // ask for which dates
    // search bday
    // print to screen
    //else if button pushed is print names of people between 2 last names
    else if (command == printNamesDOB){
    // ask for which two last names
    // search last names
    // if people found
    // print to screen
    //else
    //print error notification "no one found"
    //else if button pushed is print all family members, friends
    //or business associates
    else if (command == printPType){
    //ask for what person type
    //search person types
    //if people found
    //print to screen
    //else print "no one found"
    public void storeAddress(File addressFile){
         Scanner sc=null;
    String lname,fname,street,city,state,zip,phone,persontype,bday;
    try {
    // Delimiters specifiy where to parse tokens in a scanner
    sc = new Scanner(addressFile).useDelimiter("\\s*[\\p{,}*\\s+]\\s*");
    catch (FileNotFoundException fnfe) {
         JOptionPane.showMessageDialog(this,"Could not open the file");
    System.exit(-1);
    for(int i=0; i<MAX_ADDRESS_ENTRIES; i++){
         while (sc.hasNext()) {
    lname=(sc.next());
         if (!lname.equals("")){
         addressBookEntries[i].setLName()=lname;
    public class AddressBookEntry{
    private extPerson address;
    private String date;
    private extPerson ExtPerson;
    public class Person{
    protected String lastName, firstName;
    private String address;
    private String city;
    private String state;
    private String zipcode;
    private String homephone;
    private String extPersonType;
    private Date bday;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-DD");
    public String toString() {
    return lastName+" "+firstName;
    public void setLName(String last) {
    lastName=last;
    public void setFName(String first){
    firstName=first;
    public String getLastName() {
    return lastName;
    public String getFirstName() {
    return lastName;
    public Person() {
    lastName="";
    firstName="";
    public Person(String first, String last){
    setLName(last);
    setFName(first);
    //Set the address and return it
    public void setAddress( String addr ){
    address = addr;
    public String getAddress(){
    return address;
    //set the city and return it
    public void setCity( String town ){
    city = town;
    public String getCity(){
    return city;
    //set the state and return it
    public void setState( String st )
    state = st;
    public String getState()
    return state;
    //Set the zip code and return it
    public void setZipCode( String zip ){
    zipcode = zip;
    public String getZipCode(){
    return zipcode;
    //Set the home phone and return it
    public void setHomePhone( String homeph ){
    homephone = homeph;
    public String getHomePhone(){
    return homephone;
    //Set the bday and return it
    public Date getBday(){
    return bday;
    public void setBday(Date newBday) {
    bday = newBday;
    dateFormat.format(bday);
    //Set the extPerson type and return it
    public String getPType(){
    return extPersonType;
    public void setPBusiness(){
    extPersonType = "Business Associate";
    public void setPFamily(){
    extPersonType = "Family Member";
    public void setPFriend(){
    extPersonType = "Friend";
    public class extPerson extends Person{
    //new clss People
    public class People {
         int MAX_PEOPLE=500;
         BufferedReader bf;
    public String toString() {
              StringBuffer sb=new StringBuffer();
              for (int i=0; i<nPeople; i++)
              sb=sb.append(group[i]+"\n");
              return sb.toString();
    public void read(){
              String str;
              try {
              bf=new BufferedReader(new FileReader(new File(FILE_NAME)));
              str=bf.readLine();
              while (str!=null) {
              insert(str);
                   str=bf.readLine();
         catch (IOException e) {
              // Will jump to here on an eof condition.
         try {
              bf.close();
         catch (IOException e) {}
         public void save() {
              try {
              PrintWriter pw=new PrintWriter(FILE_NAME);
              for (int i=0; i<nPeople; i++)
              pw.println(group[i]+",");
              pw.close();
         catch (FileNotFoundException fne) {
                   System.out.println("Could not Save "+FILE_NAME);
    public People() {
              group=new extPerson[MAX_PEOPLE];
              nPeople=0;
         public boolean insert(String data) {
              if (nPeople<MAX_PEOPLE) {
              //extPerson guy=new extPerson(data);
              //group[nPeople]=guy;
              nPeople++;
              return true;
         else {
         JOptionPane.showMessageDialog(null,"Error in People" +
    "::insert: Max size reached.");
         return false;
         public void clear() {
              // This loop frees up the memory used by each extPerson
              for (int i=0; i<nPeople; i++)
              group[i]=null;
              nPeople=0;
    extPerson group[];
    int nPeople;
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    public static void createAndShowGUI(){
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Address Book Program");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container c = frame.getContentPane();
    c.add(new AddressBook(frame));
    frame.pack();
    frame.setVisible(true);
    public static void main (String s[]){       
    //Schedule a job for the event-dispatching thread:
    //creating and showign this application's GUI
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();

    Ok, I have changed my code to reflect your suggested changes, but I'm still unsure how to use the findInLine you suggested.... This is all very new to me and I've been looking on the java website for suggestions, but I'm still stumped on how to pull this together. I'm unsure on how to set the lastname,firstname,etc. for retrieval...
    Here's my code:
    //ADDRESS BOOK
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    *  @created September 14, 2004
    *  This program uses a JFrame to manipulate data and form an
    *  address book.  The user will be able to load data from a file,
    *  sort it by last name, print the address, phone number, and date
    *  of birth, print the names of people whos birthday are between 2
    *  dates, print the names of people between 2 last names, and/or
    *  print the names of different person types.
    public class AddressBook extends JPanel implements ActionListener{
        JFrame frame;
        final int numButtons = 7;
        JRadioButton[] radioButtons = new JRadioButton[numButtons];
        JButton process = new JButton("Process Request");
        JLabel title;
        JTextArea output = new JTextArea(30,50);
        int MAX_ADDRESS_ENTRIES = 500;
        AddressBookEntry addressBookEntries[] = new
        AddressBookEntry[MAX_ADDRESS_ENTRIES];
        public AddressBook(JFrame frame){
            super(new BorderLayout());
            this.frame=frame;
            JPanel choicePanel = createSimpleDialogBox();
            choicePanel.setBorder(BorderFactory.createTitledBorder("Choices" +
            " to choose from:"));
            title = new JLabel("<html><h2> Thank you for opening the " +
            "Address Book.  " +
            "Please Press the \"Process Request\" " +
            "after making a choice.</h2></html>\n",JLabel.CENTER);
            title.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
            output.setEditable(false);
            add(title, BorderLayout.NORTH);
            add(choicePanel, BorderLayout.CENTER);
            add(output, BorderLayout.SOUTH);
            final ButtonGroup group = new ButtonGroup();
            final String saveCommand = "Save";
            final String sortByLN = "Sort by Last Name";
            final String searchLNCommand = "Search By Last Name";
            final String printAPD = "Print address, phone number, and DOB";
            final String printNamesDOB = "Print names of people whose birthday" +
            " falls between 2 dates";
            final String printNamesLN = "Print names of people who fall" +
            " between 2 last names";
            final String printPType = "Print all family members, friends, or" +
            " business associates";
        private JPanel createSimpleDialogBox(){
            radioButtons[0] = new JRadioButton(
              "<html>Save the address file</html>");
            radioButtons[0].setActionCommand(saveCommand);
            radioButtons[1] = new JRadioButton(
              "<html>Sort the address file by last name</html>");
            radioButtons[1].setActionCommand(sortByLN);
            radioButtons[2] = new JRadioButton(
              "<html>Search the address file by last name</html>");
            radioButtons[2].setActionCommand(searchLNCommand);
            radioButtons[3] = new JRadioButton(
              "<html>Print the address, phone number, and DOB of a specified" +
              " person</html>");
            radioButtons[3].setActionCommand(printAPD);
            radioButtons[4] = new JRadioButton(
              "<html>Print the names of people whose birthday falls between" +
              " two dates</html>");
            radioButtons[4].setActionCommand(printNamesDOB);
            radioButtons[5] = new JRadioButton(
              "<html>Print the names of people who fall between two" +
              " specified last names</html>");
            radioButtons[5].setActionCommand(printNamesLN);
            radioButtons[6] = new JRadioButton(
              "<html>Print all family members, friends, <u>OR</u>" +
              " business associates</html>");
            radioButtons[6].setActionCommand(printPType);
            for (int i=0; i<numButtons; i++){
                group.add(radioButtons);
    //set the first button (open file) to be selected
    radioButtons[0].setSelected(true);
    return createPane(radioButtons, process);
    private JPanel createPane(JRadioButton[] radioButtons,
    JButton showButton) {
    int numChoices = radioButtons.length;
    JPanel box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
    for (int i = 0; i < numChoices; i++) {
    box.add(radioButtons[i]);
    JPanel pane = new JPanel(new BorderLayout());
    pane.add(box, BorderLayout.NORTH);
    pane.add(showButton, BorderLayout.SOUTH);
    return pane;
    public void actionPerformed(ActionEvent e) {
    String command = group.getSelection().getActionCommand();
    //else if button pushed is save
    if (command == saveCommand){
    // save file
    //else if button pushed is search by last name
    else if (command == sortByLN){
    // search by last name
    //else if button pushed is sort by last name
    else if (command == searchLNCommand){
    // sort by last name
    // print to screen
    //else if button pushed is display address, ph#, dob
    else if (command == printAPD){
    // display "search by last name" dialog
    // search last names
    // if last name found
    // print data
    // else
    // print error notification "person not found"
    //else if button pushed is list names of people whose
    //bday between 2 days
    else if (command == printNamesDOB){
    // ask for which dates
    // search bday
    // print to screen
    //else if button pushed is print names of people between 2 last names
    else if (command == printNamesDOB){
    // ask for which two last names
    // search last names
    // if people found
    // print to screen
    //else
    //print error notification "no one found"
    //else if button pushed is print all family members, friends
    //or business associates
    else if (command == printPType){
    //ask for what person type
    //search person types
    //if people found
    //print to screen
    //else print "no one found"
    public class AddressBookEntry{
    private extPerson address;
    private String date;
    private extPerson ExtPerson;
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    public static void createAndShowGUI(){
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Address Book Program");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container c = frame.getContentPane();
    c.add(new AddressBook(frame));
    frame.pack();
    frame.setVisible(true);
    public static void main (String s[]){       
    //Schedule a job for the event-dispatching thread:
    //creating and showign this application's GUI
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    //PERSON
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    public class Person{
    protected String lastName, firstName;
    private String address;
    private String city;
    private String state;
    private String zipcode;
    private String homephone;
    private String extPersonType;
    private String bday;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-DD");
    public void parseString(String s) {
              try {
              lastName = s.substring(0,s.indexOf(","));
              firstName = s.substring(s.indexOf(",")+1);
    address = s.substring(s.indexOf(",")+2);
    city = s.substring(s.indexOf(",")+3);
    state = s.substring(s.indexOf(",")+4);
    zipcode = s.substring(s.indexOf(",")+5);
    homephone = s.substring(s.indexOf(",")+6);
    extPersonType = s.substring(s.indexOf(",")+7);
    bday = s.substring(s.indexOf(",")+8);
    catch(StringIndexOutOfBoundsException sbe) {
              JOptionPane.showMessageDialog(null,"Error " +
    "in Person: Could not parse the line "+s);
    public String toString() {
    return lastName+","+firstName+","+address+","+city+","+
    state+","+zipcode+","+homephone+","+bday+","+extPersonType;
    public void setLName(String last) {
    lastName=last;
    public void setFName(String first){
    firstName=first;
    public String getLastName() {
    return lastName;
    public String getFirstName() {
    return lastName;
    public Person() {
    lastName="";
    firstName="";
    public Person(String first, String last){
    setLName(last);
    setFName(first);
    //Set the address and return it
    public void setAddress( String addr ){
    address = addr;
    public String getAddress(){
    return address;
    //set the city and return it
    public void setCity( String town ){
    city = town;
    public String getCity(){
    return city;
    //set the state and return it
    public void setState( String st )
    state = st;
    public String getState()
    return state;
    //Set the zip code and return it
    public void setZipCode( String zip ){
    zipcode = zip;
    public String getZipCode(){
    return zipcode;
    //Set the home phone and return it
    public void setHomePhone( String homeph ){
    homephone = homeph;
    public String getHomePhone(){
    return homephone;
    //Set the bday and return it
    public String getBday(){
    return bday;
    public void setBday(String newBday) {
    bday = newBday;
    dateFormat.format(bday);
    //Set the extPerson type and return it
    public String getPType(){
    return extPersonType;
    public void setPBusiness(){
    extPersonType = "Business Associate";
    public void setPFamily(){
    extPersonType = "Family Member";
    public void setPFriend(){
    extPersonType = "Friend";
    public Person(String data) {
    parseString(data);
    //EXTPERSON
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    import java.io.*;
    import java.lang.*;
    //new clss extPerson
    public class extPerson extends Person {       
         int MAX_PEOPLE=500;
         BufferedReader bf;
    String lname,fname,street,city,state,zip,phone,persontype,bday;
    String FILE_NAME="AddressBook.txt";
    public String toString() {
              StringBuffer sb=new StringBuffer();
              for (int i=0; i<nPeople; i++)
              sb=sb.append(group1[i]+"\n");
              return sb.toString();
         public void save() {
              try {
              PrintWriter pw=new PrintWriter(FILE_NAME);
              for (int i=0; i<nPeople; i++)
              pw.println(group1[i]+",");
              pw.close();
         catch (FileNotFoundException fne) {
                   System.out.println("Could not Save "+FILE_NAME);
    public extPerson() {
              group1=new extPerson[MAX_PEOPLE];
              nPeople=0;
         public boolean insert(String data) {
              if (nPeople<MAX_PEOPLE) {
              Person guy = new Person(data);
              group1[nPeople]=guy;
              nPeople++;
              return true;
         else {
         JOptionPane.showMessageDialog(null,"Error in People" +
    "::insert: Max size reached.");
         return false;
    Person group1[];
    int nPeople;

Maybe you are looking for

  • Automatic creation of PO from PR

    Hi, Please tell me if any settting missing by me for creation of automatic PO from PR 1) select automatic checkbox in vendor & material 2)create info record 3)Maintain source list 4) assign through ME57 But i face the problem that when i create PO th

  • Two different itunes libraries on same computer

    I hope someone can help me! How do i set up two different libraries on the same computer for two different ipods? My ipod is on a computer i no longer have and I'm trying to put it on a computer that has a different ipod on it. My ipod appears in Win

  • Lose Network even during streaming!

    OK, so I have 2 brand new ATVs (Canadian version if that matters). Linksys WRT160N router. Not only do I have to reset my wireless every morning on the ATV- but during streaming from my Mac's iTunes (which I turned off all power saving except for the

  • Inserting Remote Image In Mail Message?

    Hi, Is it possible to link to a Remote Image in an Apple Mail Message and have it load within the e-mail? What I mean is, can you link to a photo on a site like Flickr, and have the image display within the e-mail, rather than just the text link?

  • Received a " drop down " on my iMac advising about a new operating system OSX Yosemite is this genuine ?

    Just received a " drop down " about OSX Yosemite. Is this gen. ? I have typed my question 3 (THREE TIMES)