Wim!, a Wiggle Mouse Application

Welcome to Wim!

Image 1. Wim! Screenshot

It is a simple java application to keep your computer in awake condition and not sleep (or maybe auto log off). This application will wiggle the mouse in certain period of time automatically. I usually use this app when I am in computer laboratory in my faculty, so auto log off on my computer login will not happens. :mrgreen:

You can try this app. Download here. Furthermore, I will show my code here. Learn it for fun. It is just simple code, just 3 java files. 😉

The following is Main.java that contains main method.

//--------------------------------------------------------------------------
// Wim! (c) 2011. v01.
// By Ardi, Computer Science UI 2008
//
// Main class for running application.
//--------------------------------------------------------------------------

import javax.swing.JFrame;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;

public class Main
{
	//constructor
	public Main()
	{
                //create instance from JFrame
		JFrame frame = new JFrame ("Wim!");

		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Panel application = new Panel();
                //add instance of application to frame
		frame.getContentPane().add(application);
		//set frame imageIcon
		ImageIcon icon = new ImageIcon("image/swii_logo.png");
		frame.setIconImage(icon.getImage());

                //set window size
                frame.setSize(220,105);
		frame.setVisible(true);
	}

	//main method is executed first by compiler.
	public static void main(String[] args)
	{
		SwingUtilities.invokeLater(new Runnable(){
			public void run()
			{
				new Main();
			}
		});
	}
}

Next is Panel.java that extends JPanel. Here GUI component like JButton, JTextField, and JLabel, is constructed. Inner class Listener for event-handling is in Panel.java.Read More »

Advertisements