Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes MY LOTTERY CLASS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "MY LOTTERY CLASS" Watch "MY LOTTERY CLASS" New topic


Rupinder Bains
Ranch Hand

Joined: Jul 23, 2002
Posts: 65
How do you make an errr box. I have made a random lottery class , and I want to add 2 error boxes in it. I want this to occur via the OK button.
Basically, the user inserts 6 random numbers between 1 and 49 into textboxes. When press ok, computer should generate its own random numbers.
But if the user adds less then 6 numbers into text boxes, when pressed ok, and error box should appear, saying "Please enter 6 numbers"
If the user inserts numbers higher than 49, the a error box should appear saying,"Enter numbers from 1 to 49"
So far my code is like this:-
Is anything wrong with this?
It does design the outline of the Lottery game?
Rupinder Bains
Ranch Hand

Joined: Jul 23, 2002
Posts: 65
Lance Finney
Ranch Hand

Joined: Apr 26, 2001
Posts: 133
Check out the JOptionPane class. It has several methods to show dialogs. Here the tutorial:
I agree. Here's the link:
It's not a secret anymore!