I have been using several Microbreaks software solutions. And all of them are o开发者_如何学Goverkill and/or don't do exactly what I want.
I found that taking break every 20 minutes to stretch out and refocus my eyes helps tremendously with my energy during the whole day.
I have been using all kinds of utilities on the inet for example RSI-Shield
I want to create Swing program that will:
Take two parameters at command line:
breakLength: time of the break (default 60 sec) breakPopup: time in which the screen will get disabled. (default 20 min)The program will run as service ideally with manager icon (right bottom corner for windows) that will allow it to be terminated or suspended (in case I'm watching youtube or something I don't want break from).
When program reaches breakPopup time it will gray out whole screen and in center display couple of tips (located in tips.properties file (tip1: "Stretch legs"). It will not have count down. Nice relaxing background instead of gray background would be good idea too, guess.
When program reaches end of breakLength it will suspend it self and wait for another breakPopup schedule.
Problems:
How do write in Swing application that will cover the whole screen without having any borders? And How do you center Tips in middle of it?
What is the best way to go about writing this as service running in background with little app that would start and stop it? (Sort of like when you have tomcat on windows machine)
What is the best way to approach the timer-scheduling logic? Ideally without using third party libraries.
What universal installer would be good choice for little program like this?
How do write in Swing application that will cover the whole screen without having any borders? And How do you center Tips in middle of it?
frame.setUndecorated(true); // removes all frame decorations
frame.setExtendedState(Frame.MAXIMIZED_BOTH); // make window appear maximized both horizontally and vertically
What is the best way to go about writing this as service running in background with little app that would start and stop it? (Sort of like when you have tomcat on windows machine)
Well, start your java application, then schedule, through a TimerTask
, the display of your main frame. But beware, display has to occur in event dispatch Thread. To do so, make your TimerTask call SwingUtilites#invokeLater()
... or simply call
What is the best way to approach the timer-scheduling logic? Ideally without using third party libraries.
Well, Seems like Timer and TimerTask are parts of the JDK, so you can use them without any problem.
What universal installer would be good choice for little program like this.
I've heard very good feedback about IzPack, but I can't ensure it's the best fit.
精彩评论