• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lottery GUI issues

 
Han Sal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, im really struggling with a lottery GUI programme that i need to create for one of my assignments. I have created the core functions to store, sort, shuffle and display the lottery numbers but need help with the GUI aspects of the programme. The code i have added below compiles without errors.

The bits that i need to add to my exisiting class includes displaying a logo, a button and a text box to contain the six numbers. The numbers should only be generated when the button is pressed.

I have looked at numerious GUI swing tutorials and have had a go myself to no avail. My lecturer doesnt offer much help as she is teaching me java out of a book herself and I would be grateful if someone could offer a hand. Im still relatively new to programming but i do wish to become more familiar with java.

 
Campbell Ritchie
Sheriff
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • 1: Find out how to deal with a top‑level container. You will almost certainly want a JFrame.
  • 2: Work out how to start a Swing application, using the EDT. I told somebody else this morning.
  • 3: Work out how to get the frame visible, at a particular location and with a particular size.
  • 4: That should take you the rest of the day.
  • 6: And I won’t tell you where you can find a tutorial.
  • 7: Ask again for the next stage.

  • It is unfortunate if somebody who is teaching has to learn from a book as they go along, but it is a good idea to use a good book as a reminder of what you might have forgotten. You will have to learn your GUI in stages, and I shall move you to the GUIs forum. Which book are you using?



    And welcome to the Ranch
     
    Campbell Ritchie
    Sheriff
    Posts: 48382
    56
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Does that lottery number class actually work? What you want is to be able to pass an int eg 6 to a constructor or method and have something return an array that size containing the numbers. You need that working as the actual application before you put the GUI on top of that.
     
    Tony Docherty
    Bartender
    Posts: 2939
    59
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Campbell Ritchie wrote:1: Find out how to deal with a top‑level container. You will almost certainly want a JFrame.
    2: Work out how to start a Swing application, using the EDT. I told somebody else this morning.
    3: Work out how to get the frame visible, at a particular location and with a particular size.
    4: That should take you the rest of the day.
    6: And I won’t tell you where you can find a tutorial.
    7: Ask again for the next stage.

    Err, what happened to 5.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic