Help with NSArray

Discussion in 'Java' started by CyberSpiff, Feb 23, 2005.

  1. CyberSpiff

    CyberSpiff Guest

    [already posted to comp.sys.mac.programmer.help - sorry, but I just
    found this newsgroup as well]

    First, let me apologize for my rookie questions and possible breach of
    protocol, but I am a rank beginner at Macintosh coding. I've got quite a
    few years of C coding experience, but never attempted Java or anything
    object-oriented. I'm laid-up after surgery and to amuse myself and learn
    I'm trying to write a simple Mac app using Cocoa and Java. I've started
    with searching the net and newsgroups, but in this case I haven't found
    a clear-cut example.

    What I want to do is pre-load a pull-down menu with entries to allow
    entering of dates and times. I've got the pull-downs setup in IB, but
    can't figure out how to load the text values into them. For example, the
    month pull-down should contain something like "Jan" in the top entry,
    followed by "Feb", etc. Days should be "1", then "2", etc.

    What I'm stuck at is finding a clear example of initializing the
    pull-downs. It seems like an NSArray would do the trick, but I may be
    missing the boat entirely. If someone has been through this can could
    provide some direction, it would be greatly appreciated.

    Thanks in advance...

    --
    -spiff
    Never be bullied into silence. Never allow yourself to be made a victim.
    Accept no one's definition of your life; define yourself.

    --

    -spiff
    Never be bullied into silence. Never allow yourself to be made a victim.
    Accept no one's definition of your life; define yourself.
     
    CyberSpiff, Feb 23, 2005
    #1
    1. Advertising

  2. CyberSpiff

    Rhino Guest

    "CyberSpiff" <> wrote in message
    news:lF0Td.20270$...
    > [already posted to comp.sys.mac.programmer.help - sorry, but I just
    > found this newsgroup as well]
    >
    > First, let me apologize for my rookie questions and possible breach of
    > protocol, but I am a rank beginner at Macintosh coding. I've got quite a
    > few years of C coding experience, but never attempted Java or anything
    > object-oriented. I'm laid-up after surgery and to amuse myself and learn
    > I'm trying to write a simple Mac app using Cocoa and Java. I've started
    > with searching the net and newsgroups, but in this case I haven't found
    > a clear-cut example.
    >

    Good for you for using your time so productively!

    > What I want to do is pre-load a pull-down menu with entries to allow
    > entering of dates and times. I've got the pull-downs setup in IB, but
    > can't figure out how to load the text values into them. For example, the
    > month pull-down should contain something like "Jan" in the top entry,
    > followed by "Feb", etc. Days should be "1", then "2", etc.
    >

    I'm not familiar with the acronym 'IB'; I'm guessing it is your IDE.

    It's not at all common to see people enter data via menu items; a menu is
    typically used to take you to a dialog that prompts for dates, times, names,
    numbers, etc. but the menu rarely asks this information directly.

    > What I'm stuck at is finding a clear example of initializing the
    > pull-downs. It seems like an NSArray would do the trick, but I may be
    > missing the boat entirely. If someone has been through this can could
    > provide some direction, it would be greatly appreciated.
    >

    I don't see any class called 'NSArray' in the Java 1.5 API, nor do I see
    anything that might normally be abbreviated that way, like "NameSpaceArray"
    if there was such a class. Is this a non-standard class that isn't in the
    standard API? If so, I can't comment on whether it is the best approach or
    not.

    My advice to you is to have a look at the Java Tutorial, particularly the
    trail entitled "Creating a GUI with JFC/Swing", at
    http://java.sun.com/docs/books/tutorial/index.html. That should do a good
    job of guiding you through any GUI components you want to use, including
    menus, Lists, and ComboBoxes. Initialization of Lists and ComboBoxes is
    typically accomplished via Models, as you'll see in the tutorial.

    Rhino
     
    Rhino, Feb 23, 2005
    #2
    1. Advertising

  3. CyberSpiff

    CyberSpiff Guest

    Rhino wrote:
    >[snip]
    >
    > I don't see any class called 'NSArray' in the Java 1.5 API, nor do I see
    > anything that might normally be abbreviated that way, like "NameSpaceArray"
    > if there was such a class. Is this a non-standard class that isn't in the
    > standard API? If so, I can't comment on whether it is the best approach or
    > not.
    >
    > My advice to you is to have a look at the Java Tutorial, particularly the
    > trail entitled "Creating a GUI with JFC/Swing", at
    > http://java.sun.com/docs/books/tutorial/index.html. That should do a good
    > job of guiding you through any GUI components you want to use, including
    > menus, Lists, and ComboBoxes. Initialization of Lists and ComboBoxes is
    > typically accomplished via Models, as you'll see in the tutorial.
    >
    > Rhino


    Rhino, thank you for your advice. It pointed me in the right direction.
    I should have been more explicit in my original post. I'm using the
    Xcode development system from Apple, and the NSArray is part of their
    foundation classes (NS=NEXTStep?) (forgive me if my terminology is wrong).

    Your suggestion to look for ComboBoxes was very helpful. I found an
    NSComboBox class that does exactly what I needed.

    Now, onto file I/O! :)

    Thank you once again...

    --
    -spiff
    Never be bullied into silence. Never allow yourself to be made a victim.
    Accept no one's definition of your life; define yourself.
     
    CyberSpiff, Feb 23, 2005
    #3
  4. CyberSpiff

    Rhino Guest

    "CyberSpiff" <> wrote in message
    news:aD2Td.20382$...
    > Rhino wrote:
    > >[snip]
    > >
    > > I don't see any class called 'NSArray' in the Java 1.5 API, nor do I see
    > > anything that might normally be abbreviated that way, like

    "NameSpaceArray"
    > > if there was such a class. Is this a non-standard class that isn't in

    the
    > > standard API? If so, I can't comment on whether it is the best approach

    or
    > > not.
    > >
    > > My advice to you is to have a look at the Java Tutorial, particularly

    the
    > > trail entitled "Creating a GUI with JFC/Swing", at
    > > http://java.sun.com/docs/books/tutorial/index.html. That should do a

    good
    > > job of guiding you through any GUI components you want to use, including
    > > menus, Lists, and ComboBoxes. Initialization of Lists and ComboBoxes is
    > > typically accomplished via Models, as you'll see in the tutorial.
    > >
    > > Rhino

    >
    > Rhino, thank you for your advice. It pointed me in the right direction.
    > I should have been more explicit in my original post. I'm using the
    > Xcode development system from Apple, and the NSArray is part of their
    > foundation classes (NS=NEXTStep?) (forgive me if my terminology is wrong).
    >

    Thanks for the clarification ;-)

    I'm not familiar with 'Xcode' and know precious little about Macs in
    general. However, you may want to consider one thing before using these 'NS'
    classes. There's nothing forcing you to use the two standard Java GUIs, AWT
    and Swing/JFC, but if you don't use those two GUIs, your applications will
    need to distribute the 'NS' classes with your application code so that other
    users can run them; if you use AWT or Swing/JFC, you only need to distribute
    your application and the GUI classes will already be present in the JRE
    (Java Runtime Environment). Therefore, using 'NS' classes gives you a lot
    more to distribute/install than if you used AWT or Swing/JFC. That could be
    a major factor for you - or not.

    > Your suggestion to look for ComboBoxes was very helpful. I found an
    > NSComboBox class that does exactly what I needed.
    >
    > Now, onto file I/O! :)
    >
    > Thank you once again...
    >

    You're very welcome!

    Rhino
     
    Rhino, Feb 23, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dHJlbGxvdzQyMg==?=

    HELP! HELP! HELP! Opening Web Application Project Error

    =?Utf-8?B?dHJlbGxvdzQyMg==?=, Feb 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    772
    =?Utf-8?B?dHJlbGxvdzQyMg==?=
    Feb 20, 2004
  2. Harvey
    Replies:
    0
    Views:
    715
    Harvey
    Jul 16, 2004
  3. Harvey
    Replies:
    1
    Views:
    851
    Daniel
    Jul 16, 2004
  4. =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=

    HELP - HELP - HELP

    =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?=, Mar 9, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    686
    Eliyahu Goldin
    Mar 9, 2006
  5. Buster

    Help, Help, Help

    Buster, Oct 4, 2003, in forum: Java
    Replies:
    3
    Views:
    477
    Saager
    Oct 30, 2003
Loading...

Share This Page