Inspiration
We tried brainstorming different ideas for the challenge. Solutions such as an assignment tracker and a budgeting helper were in the air, but eventually we decided with a work/break timer. This is because we thought it would be feasible with our first year coding knowledge, yet challenging enough to put our skills to the test.
What it does
The timer opens up to a small window, prompting the user to enter how long they want to work for, and how long they want to take for a break. Once they enter this information, the user is brought to a larger window with their timer, in big letters, in the middle of the screen. There are buttons underneath the timer, allowing the user to change the timer in some way, e.g. a play/pause timer button, a reset timer button, a button to effectively start the program again, letting the user enter a new time, and a save/load feature, which lets the user save one time setup to a file, and then can load said setup whenever they run the program. The software also displays one of fifteen insiprational sentences, which change every minute, to help encourage the worker. The timer also lets the user edit the time left, when it is paused.
How we built it
The timer was created using the java Swing library. We had little knowledge of how to use this, so we had to do constant research along the creation process. We made frequent use of multithreading, which was also new to us. We used a JTextField, which we had to setEditable to false, when playing the timer. we used a new thread whenever a button was pressed, each programmed to do their own thing.
Challenges we ran into
One challenge we faced in the making of our timer was that we couldnt figure out how to turn the seconds value, which is what was used to count down, into a minutes:seconds format. Eventually this was completed, by dividing the total seconds by 60 to get the number of minutes. and by mod60-ing the total seconds to find out the remaining seconds. Another problem we faced was trying to get the timer to display on the screen. Since we were used to working with console commands, as first years, accessing the values from the gui was slightly more challenging, but eventually we got it working. A third problem we faced was when the timer ticked down to zero from work, the first time, it worked, and switched to break, but then couldnt switch back to work once that timer ended. eventually we realised that this was because we had put the code to change the work state, was in the reset button's code, instead of in the refresh thread, that was checked every second.
Accomplishments and what we learned
We are particularly proud of our GUI, which is layed out in an accessible format. We learned lots about the java swing library, making this, which will help in our future projects. We are also proud of our use of threads in our project. We created a new thread for the different windows that were opened, and also created action listeners for many different features. A third thing we are proud of is our timer, which ticks every second and updates the display.
Conclusion
We feel that this is a great project for our first Hackathon. We learned lots of new concepts, and improved our teamworking skills in the process.
Log in or sign up for Devpost to join the conversation.