Creating menus at runtime

Discussion in 'Java' started by Braga, Jun 18, 2004.

  1. Braga

    Braga Guest

    Hi.
    I whant create my menus (Jmenu) from array aMenus ={"File","Edit",
    "Help"}
    and menu items (JMenuItem) from array aItems =
    {"File,New","File,Save","File,Exit","Edit,Paste", "Edit,Cut",
    "Help,Help"}

    my big problem I DON'T KNOW HOW TO DO to create menus at runtime...
    aney help please..
    Braga, Jun 18, 2004
    #1
    1. Advertising

  2. On 18 Jun 2004 10:59:07 -0700, Braga wrote:
    ...
    > my big problem I DON'T KNOW HOW TO DO to create menus at runtime...


    ...that and random SHOUTING..

    > aney help please..


    please take these sort of
    questions over to a more appropriate group..
    <http://www.physci.org/codes/javafaq.jsp#cljh>

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Jun 18, 2004
    #2
    1. Advertising

  3. Braga schrieb:
    > Hi.
    > I whant create my menus (Jmenu) from array aMenus ={"File","Edit",
    > "Help"}
    > and menu items (JMenuItem) from array aItems =
    > {"File,New","File,Save","File,Exit","Edit,Paste", "Edit,Cut",
    > "Help,Help"}
    >
    > my big problem I DON'T KNOW HOW TO DO to create menus at runtime...
    > aney help please..


    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JMenu.html

    tells me I can create a JMenu like this:

    JMenu menu = new JMenu("File");

    There is even more, it also tells me that I can add a JMenuItem. Wow!

    JMenuItem item = new JMenuItem("New");
    menu.add(item);

    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JMenuItem.html
    http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html

    If you want to become a good programmer, learn to read the documentation
    first.
    Thomas Kellerer, Jun 18, 2004
    #3
  4. In article <>,
    Braga <> wrote:
    >Hi.
    >I whant create my menus (Jmenu) from array aMenus ={"File","Edit",
    >"Help"}
    >and menu items (JMenuItem) from array aItems =
    >{"File,New","File,Save","File,Exit","Edit,Paste", "Edit,Cut",
    >"Help,Help"}
    >
    >my big problem I DON'T KNOW HOW TO DO to create menus at runtime...
    >aney help please..


    This doesn't directly help the OP but...
    I've been working on a package for automating menu construction, based on an
    idea of Roedy's, whose current state is found at
    http://www.cs.queensu.ca/home/dalam...menu/package-summary.html#package_description

    I'd appreciate knowing if there's someone willing to be create or convert a
    small application or applet for which automated menu creation might be useful.
    --
    "Yo' ideas need to be thinked befo' they are say'd" - Ian Lamb, age 3.5
    http://www.cs.queensu.ca/~dalamb/ qucis->cs to reply (it's a long story...)
    David Alex Lamb, Jun 19, 2004
    #4
  5. Braga

    Yu SONG Guest

    Braga wrote:
    > Hi.
    > I whant create my menus (Jmenu) from array aMenus ={"File","Edit",
    > "Help"}
    > and menu items (JMenuItem) from array aItems =
    > {"File,New","File,Save","File,Exit","Edit,Paste", "Edit,Cut",
    > "Help,Help"}
    >
    > my big problem I DON'T KNOW HOW TO DO to create menus at runtime...
    > aney help please..


    Have a look at API.

    Also you may need to consider thread issues (i.e. event-dispatching
    thread) for "changing" GUI.

    --
    Song

    /* E-mail.c */
    #define User "Yu.Song"
    #define Warwick "warwick.ac.uk"
    int main() {
    printf("Yu Song's E-mail: %s@%s", User, Warwick);
    return 0;}

    Further Info. : http://www.dcs.warwick.ac.uk/~esubbn/
    _______________________________________________________
    Yu SONG, Jun 20, 2004
    #5
    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?U2FuZHk=?=

    Creating menus

    =?Utf-8?B?U2FuZHk=?=, Jan 29, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    537
    Mark Rae
    Jan 29, 2005
  2. paulakeijzers

    creating dynamic menus with submenus from sql

    paulakeijzers, Nov 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,504
    Mr Newbie
    Nov 8, 2005
  3. news.west.cox.net

    Select menus above flyout menus? help?

    news.west.cox.net, Dec 8, 2004, in forum: HTML
    Replies:
    8
    Views:
    793
  4. Peter
    Replies:
    4
    Views:
    456
    Robert Frost-Bridges
    Jul 7, 2005
  5. dilipv
    Replies:
    2
    Views:
    854
    dilipv
    Feb 29, 2008
Loading...

Share This Page