Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: Menu of Menus Help

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Menu of Menus Help

    Hey.. I'm taking a computer science class in my high school and it's time to work on our "final project"... I've had this idea to create a POS (Point of Sale) System that a company could use whether it be a restaurant or store of some kind. I'm going to want this program to keep inventory of objects, print chits, and place orders (which will be kind of like putting the chit together?)

    I guess an order will be a class.. And the PrintChit will outfile a receipt or something..
    I guess it an addItem method could add whatever the item is to an ArrayList which would store the order.

    My real question is basically how to create the menu system..

    I want the outer menu to maybe be a login.. Inside I want the store functions (see below)
    If I can't do a login.. I want to have an outer screen which will have n number of buttons with store functions (ie. See Open Orders, create new order, close order, Inventory, Total Sales for Compilation, maybe add user function for login)

    I need to create a window with a series of JButtons.. I want to be able to have this window (lets call it a menu) be able to open sub menus (perhaps in the same window?) with an actionListener.. The logic behind it is simple.. I'm not too sure the coding is... Maybe if someone could craft a basic example for me? Or at least give me a place to learn or some instructions.. I would be extremely helpful! Thank you to anyone in advance!

    Strivelli


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Menu of Menus Help

    What code do you have so far?

  3. #3
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Menu of Menus Help

    Have you taken a look at this yet?. It's a fairly concise tutorial on how to create and use menus in Java (I think it's focused on Swing)

  4. #4
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Menu of Menus Help

    I haven't written any code yet.. I really can't do much until I figure out how to link the menus.. Building windows with JButtons that store different kinds of data I can do.. It's the mechanics and coding behind linking 2 windows that would usually be separate, together by clicking the JButton..

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Menu of Menus Help

    I really can't do much until I figure out how to link the menus
    Not sure what LINK Menus means. Can you explain what that means?

  6. #6
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Menu of Menus Help

    Sure.. Hmmmm. I guess here's an example.. I'll explain this and try to think of a better one. Imagine you are on a windows computer, or a Mac.. Either way.. You go to your desktop and you click on a folder. That opens a window (the contents of the folder). Lets say that folder has 9 folders in it. In each of those folders that are more folders. Everytime you click a folder (similar to a JButton) you continue down the hierarchy of the folder system. That's basically what I want. A window.. It'll have 2 buttons. You click one of em, and that goes to a new window with more buttons. Eventually you will reach an end and need a button to go back through the "menus". I need to know how to program buttons to respond like that. To open a new window of buttons... Maybe in the same window? Or... Over the same window?

    Understand?

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Menu of Menus Help

    click one of em, and that goes to a new window
    Have the event processing code for the button click create a new JFrame and populate it as usual.
    Or do you want to replace what is in the current window with new content?

  8. #8
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Menu of Menus Help

    Quote Originally Posted by Norm View Post
    Have the event processing code for the button click create a new JFrame and populate it as usual.
    Or do you want to replace what is in the current window with new content?
    I would prefer having it replace the existing content in current window with new contents... Otherwise, I don't know why I didn't think to do it that way. Here's another question... Where would you store the information for this system, so that say you wanted to "add an item" into the system through the UI as opposed to the code.. where would you store the data that would be used to construct the UI? In a local text file to be updated?

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Menu of Menus Help

    To change what's shown in a window, see the Cardlayout or the JTabbedPane classes

  10. #10
    Junior Member
    Join Date
    Jun 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Menu of Menus Help

    And for the storage of the window contents?

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Menu of Menus Help

    What contents? There are text components, and selected menuitems and checkboxes and ...
    Create variables of the appropriate type and copy the contents of the window's components to those variables.

Similar Threads

  1. popup menu
    By antonio69 in forum AWT / Java Swing
    Replies: 1
    Last Post: May 20th, 2010, 04:24 AM
  2. Bookmarks/Favorites Menu
    By oiradranlom in forum Java Theory & Questions
    Replies: 3
    Last Post: April 30th, 2010, 11:29 AM
  3. Help with Menu/BinSearch
    By jhar131 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 19th, 2010, 07:38 PM
  4. Help - Return to menu screen
    By throzen in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 29th, 2009, 01:44 PM
  5. Building a Menu List
    By websey in forum AWT / Java Swing
    Replies: 1
    Last Post: November 15th, 2009, 10:34 AM

Tags for this Thread