Friday, September 3, 2010

Vaccine Scheduler

Vaccine scheduler is desktop based software built in java, swing and mysql that provides the utility to schedule the vaccination of vaccine for doctor’s client and send the reminders to clients before the scheduled date of vaccination. So it increases the probability of not missing a vaccine to vaccination at proper time. Hence it is useful for both doctors and clients (patient). This software has been built in such a way that you can configure vaccine schedule according to standards. In future a new vaccine may be introduced, so we have kept in mind of adding new vaccines. Hence it makes this software strongly configurable.

Interested in Vaccine Scheduler? Click here to contact us.


Core features:
1. New client registration:
Doctor can register new client (Patient), at the time of registration system generates the vaccine schedule for that client. Following screen shows the client information. Doctor is able to edit/update the client information. Searching for client also there integrated.


2. View Client Schedule Chart:
This provides the utility to track the client schedule. This screen shows the information about the vaccine scheduled for a client. Here you can track about due date, given date, Notification sent etc. And also able to set the status of client’s particular vaccine. Different color show different functionality.



3. Vaccine Configuration / setting:
Here you can add new vaccine. It gives you a benefit if a new vaccine is discovered in future, you can add that vaccine in this system.


On following screen you can add time periods on which vaccination is to be scheduled. This information is used in defining vaccine schedule description.

Following screen provides the utility add the schedule vaccine time and dose number for a particular vaccine.


4. Email Configuration:
This is the email smtp configuration for sending the reminder of vaccination to client.

Interested in Vaccine Scheduler? Click here to contact us.

This entry was originally published at Experts Support Blog

Centering a swing window on screen

In swing or AWT, if you initialize a frame or window by default its position start from the top left corner of screen. Some time it looks odd as we are intended to see the window/frame at center of screen.
To make a window centered, we all need to set the location of window to center with respect to screen size.
There are following steps to make a window centered.
1. Get the screen size
2. Set the window/frame location by calculating it with screen size and frame size.

See the following example.
centerOnScreen Method provide the functionality to make a window centered.

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
*
* @author vipin
*/
public class CenteredFrameExample {

JFrame frame;
JLabel label;
public CenteredFrameExample() {
frame = new JFrame("Centered JFrame.");
label = new JLabel();
frame.setSize(250, 150);
frame.setPreferredSize(new Dimension(250, 150));
frame.getContentPane().add(BorderLayout.CENTER, label);
centerOnScreen(frame);
frame.setVisible(true);
frame.pack();
}

public static void main(String args[]) {
CenteredFrameExample centeredFrame = new CenteredFrameExample();
String text = "<html><divstyle='font-weight:bold;color:green;padding:5px;'>This is the centered frame...</div></html>";
centeredFrame.label.setText(text);
}

/**
* Centers a window on screen.
* <p>
* @param w The window to center.
*/
public void centerOnScreen(Window w) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

w.setLocation(screenSize.width / 2 - (w.getWidth() / 2),
screenSize.height / 2 - (w.getHeight() / 2));
}
}


That's all...

This entry was originally published at Experts Support Blog

Task scheduling in java – recurring tasks and one time occurring tasks

In this blog we will learn how to schedule a timer task to run at certain time. Java provides a facility to schedule tasks as per requirement.
java.util.TimerTask instance provides a task that can be scheduled to run one time or after scheduled periodic time. We can define actions to be performed by this timer task instance. We all need to override the run method of TimerTask class.
java.util.Timer Class provides the facility to schedule a timer task to occur in future in a separate background thread. Timer.schedule() method provides the functions to performed a task for one time or a periodic time interval. You can specify the initial delay.

Examples:
Scheduling a onetime occurring and a recurring task
MyTask.java

import java.util.Timer;
import java.util.TimerTask;
public class MyTask extends TimerTask {

// override the run method to perform a scheduled task action.
public void run() {
System.out.println("Running a task.");
}
}

MyTaskScheduler.java

import java.util.*;
public class MyTaskScheduler {
public static void main(String[] args) {
MyTask task = new MyTask();
Timer timer = new Timer();
// one time occurring task with specified 2 second initial delay and after every 1 second period.
timer.schedule (task, 2000, 1000);
// Schedule a task to run after every 1 second (1000 millisecond) – recurring task
timer.schedule( task, 1000);
}
}

We can also use Timer class’ method scheduleAtFixedRate() for recurring task.

This entry was originally published at Experts Support Blog