Results 1 to 6 of 6
  1. #1
    Razel is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default can anyone tell me how to create nested menus from a sub menu?

    Hi, can anyone tell me how to create nested menus from a sub menu? shld i be declaring both sub and nested menus as JMenuItem or smthg else? thx in advance.
    Last edited by Razel; 02-07-2010 at 05:53 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    29

    Default

    In what context? Is this a Swing GUI program? SWT? Console? What do you have so far?

    Oh, and welcome to the forum.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,421
    Blog Entries
    7
    Rep Power
    26

    Default

    Quote Originally Posted by Razel View Post
    Hi, can anyone tell me how to create nested menus from a sub menu? shld i be declaring both sub and nested menus as JMenuItem or smthg else? thx in advance.
    If you're using Swing note that a JMenu is a JMenuItem (it extends that class) so it can be used as such.

    kind regards,

    Jos

  4. #4
    Razel is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default

    Thx for ur reply. i'm using Swing GUI program. I already used JMenu for my main heading & JMenuItem for my sub headings. It works fine but when i tried to create a nested menus from sub heading, i got some errors when i used JMenuItem. Is there any other way to declare nested menus?

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,421
    Blog Entries
    7
    Rep Power
    26

    Default

    Quote Originally Posted by Razel View Post
    Thx for ur reply. i'm using Swing GUI program. I already used JMenu for my main heading & JMenuItem for my sub headings. It works fine but when i tried to create a nested menus from sub heading, i got some errors when i used JMenuItem. Is there any other way to declare nested menus?
    I don't understand your question; all I can say is use a JMenu as if it were a JMenuItem and voila, you have your nested menu.

    kind regards,

    Jos

  6. #6
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    10

    Default

    Have you read the API and followed the link to the Swing tutorial on "How to Use Menus" which contains a working example with sub menus?

Similar Threads

  1. customizing menus
    By rotte001 in forum Eclipse
    Replies: 0
    Last Post: 02-06-2010, 08:04 PM
  2. how to create menu-driven programs?
    By princess.blue in forum Eclipse
    Replies: 0
    Last Post: 12-07-2009, 09:01 AM
  3. Menus Not Displaying
    By kahaj in forum AWT / Swing
    Replies: 12
    Last Post: 09-23-2009, 05:31 AM
  4. Replies: 7
    Last Post: 05-09-2008, 08:54 AM
  5. how to create a menu bar in java
    By tommy in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •