Alarm manager 1.0 beta
- What is it?
Simple Java program (which I am going to upgrade further, this is beta version) for alarms/timers management. It plays user-defined sound at a time set. If an alarm has passed while the computer was off, a message is shown on a program start-up. So in fact the program may also work a bit like a calendar. Works in background.
- How did it started and why did I do it?
Why do I write this program? That’s a good question… Maybe because I’m too lazy to get my phone from the night table after I put some food in the oven? ;) I have no idea, but it’s a lot of fun :D And I cannot blame anyone if the program doesn’t work properly or doesn’t have particular features – it’s exactly how I would like it to be (ok, maybe not yet, but it’ll be).
- What still has to be done?
- Recreate a main window:
– alarms displayed are not sorted (only the first one is the earliest one, the rest is random)
– it’s ugly :P (I have used JTable but I am going to create it on my own with JComponents)
- “new alarm frame” should be entirely rewritten
– it’s always allowed to set an alarm on 29th of February (I guess that 1st March is set instead)
– when user enters 8 as an hour (in alarm), the next field should be focused, because nothing else can be entered; in timer this restriction is intentionally turned off so user can set a timer e.g. for 72 hours
– some parts of code I think are the same for different classes
- Create a counter for the first alarm.
- Allow some additional options for the main window, like setting it always on top or “undecorated” (i.e. no buttons close/minimize, no resizing, no dragging).
- Default sound is not set.
- History of last notes.
- Different sounds for different alarms.
- Saving settings and alarms as editable text files instead of serialization.
- Add “snooze” option for alarms passed.
- Any other ideas? ;)
- What interesting does it have and what have I learnt?
- Using other JAR files (ok, I knew it before) – in this case I have used JLayer – MP3 library for the Java Platform
- Creating a tray icon – that’s where you can add new alarm or exit the program.
- Inter-process communication using sockets – starting the program, if one instance is already running, results in adding a new alarm. Opening another file will crash the second program (ok, it will work, but… never mind, just don’t do this).
- Locking files – only one instance of a program may be running at the same time (until you copy a file, never mind)
- Image files can be included in a JAR library and used from there via getResource method, but it is impossible to create a java.io.File in that way (so included sample.mp3 has to be read as a stream or provided outside the JAR library)
- Finally, I have learnt that JFileChooser is slightly buggy and Sun/Oracle is not going to do anything with it (a series of bugs has been reported in 2008).
- How to download, install and see the code?
Download the program from here. Create a directory for it and unpack downloaded file there. Create a link/shortcut file to Alarm_manager.jar and put it in your autostart (in Windows 7 it’s “shell:startup”). Run the program, in the preference choose an mp3 file you would like to have as your alarm sound (I didn’t test other files). You can close all windows and access them via tray icon if necessary.
Code can be seen here.
If you had any ideas, suggestions, problems (or even complaints) – let me know.