This is my personal project I work on to tackle on different problems in generating random number program and turn into a user-friendly useable application using more on Java Swing. The purpose of this project is practice and improve my thinking towards the specific achievement - a functional application with graphics and easy to use.
Random number generator is an essential program in most of people's lives with different unique uses - for small lottery party games, solve the problems of missing dices games, choose people or divide group with random people, etc.. Not only it is to solve daily random number - related problems, it is also used for such purpose as in science, mathematics, and more. As a person who also use them a lot in my daily lives and a Computer Science student, I was inspired and feel the urge of making one for myself and local uses.
Eclipse IDE
The application will generate the random number in a user-defined range. The user will enter the number where they want the random range to start with and then enter the number they want for the end of the range. These actions can be done by pressing, interacting with the button interfaces.
A console program was created first to easily test, track and debug the logic errors. After the console program is working perfectly, the design of the random number generator was tested, the visuals and interfaces are inspired by many other random number generators. The arrays is used to store the buttons, and JFrame is responsible for creating the window. In order to populate the arrays, for loop is used for code readability, and avoid redundant code. JLabel is in charge of labeling buttons, showing right text for each button, and each button has to do the expected function. After taking all the user inputs, the application will then perform the random number generating in range logic to output a random number within the range on to the screen.
- Java Swing and how to implement simple buttons, and deliver the user's inputs to the program to work as expectations.
- How to practice code readability, debugging, and avoid redundant code.
- Get used to build an useable application rather than just the program itself.
- Appropriate Mathematics logic that apply to solve such problems along the way for the program to work correctly.
- The application can be more polished if after generating number a short time screen showing the generated number, emphasize the value of the number.
- It can also be extended by implemented more different modes: A mixed random of alphanumerics (number mixed with letters) in a wanted order just like license plate, a pure random number, or random betweens alphabet letters.
