I came across this Java code today, which does something that I would like to do in Visual Basic. I don't know a single thing about Java, so I was wondering if there is anyone out there who could translate it.

This Java code was created and copyrighted by Herb Weiner. Here is the site I got it from:
http://www.wiskit.com/calendar.html

I can guess that "int thisMonth;" would be translated as "Dim thisMonth As Integer," and "//" is a comment, but that's as far as I can get. If anyone could translate this into Visual Basic, I'd be much obliged.

The code:
Code:
// Copyright (c) 1996 Herb Weiner <[email protected]>. All rights reserved.

import java.applet.*;
import java.awt.*;
import java.util.*;

public class calendar extends Applet
{
	Graphics	screenG;
	Dimension	dimension;
	Choice		month;
	TextField	year;
	Button		previous;
	Button		next;
	Date		today;
	int			thisMonth;
	int			thisYear;
	int			selectedMonth;
	int			selectedYear;
	int			colWidth;
	int			rowHeight;
	int			monthDays [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int			leapDays [] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	FontMetrics	metrics;

	public static void main (String args[])
	{
		//	This main is not used when this program is invoked as an
		//	applet, but the code here allows this program to run as
		//	either a standalone java program or as an applet.

		Frame	f1;
		calendar	c1;

		c1 = new calendar();
		c1.setLayout (new FlowLayout());

		f1 = new Frame ("Perpetual Calendar");
		f1.resize (375, 350);
		f1.add ("Center", c1);
		f1.show();

		c1.init();
		c1.start();
		c1.getLayout().layoutContainer (c1);
	}

	public String getAppletInfo ()
	{
		return ("Copyright (C) 1996 Herb Weiner. All rights reserved");
	}

	public boolean leapYear (int year)
	{
		if ((year % 400) == 0)
			return (true);

		if ((year > 1582) && ((year % 100) == 0))
			return (false);

		if ((year % 4) == 0)
			return (true);

		return (false);
	}

	public void drawMonth (int startDay, int nDays, boolean special)
	{
		int		i;
		int		col = startDay + 1;
		int		row = 2;
		int		x;
		int		y;
		String	s;

		for (i = 1; i <= nDays; i++)
		{
			if (special && (i == 5))
				i += 10;	// skip 10 days (Oct 5-14) in October, 1582

			s = "" + i;

			x = col * colWidth - metrics.stringWidth (s);
			y = row * rowHeight;

			screenG.drawString (s, x, y);

			col++;
			if (col > 7)
			{
				col = 1;
				row++;
			}
		}
	}

	public void doMonth (int month, int year)
	{
		boolean	leap = leapYear (year);
		int		daysInMonth;
		int		startOfMonth;
		int		y = year - 1;
		int		i;
		boolean	special = ((year == 1582) && (month == 9));
		boolean pre = ((year < 1582) || ((year == 1582) && (month <= 9)));

		if (pre)
			startOfMonth = 6 + y + (y / 4);
		else
			startOfMonth = 1 + y + (y / 4) - (y / 100) + (y / 400);

		if (leap)
		{
			daysInMonth = leapDays [month];
			for (i = 0; i < month; i++)
				startOfMonth += leapDays ; //This should be an "i" in brackets followed by a ";" The board thinks I want italics.
		}
		else
		{
			daysInMonth = monthDays [month];
			for (i = 0; i < month; i++)
				startOfMonth += monthDays ; //This also should be an "i" in brackets followed by a ";"
		}

		drawMonth (startOfMonth % 7, daysInMonth, special);
	}

	public int parseYear (String y)
	{
		if ((y.length () == 4)
		  && (y.charAt(0) >= '0') && (y.charAt(0) <= '9')
		  && (y.charAt(1) >= '0') && (y.charAt(1) <= '9')
		  && (y.charAt(2) >= '0') && (y.charAt(2) <= '9')
		  && (y.charAt(3) >= '0') && (y.charAt(3) <= '9'))
			return (Integer.parseInt (y));
		else
			return (-1);
	}

	public void init ()
	{
		dimension = size ();
		colWidth = dimension.width / 8;
		rowHeight = dimension.height / 7;

		today = new Date ();
		thisMonth = today.getMonth ();
		thisYear = today.getYear () + 1900;

		selectedMonth = thisMonth;
		selectedYear = thisYear;

		previous = new Button ("Previous Month");
		add (previous);

		month = new Choice ();
		month.addItem ("January");
		month.addItem ("February");
		month.addItem ("March");
		month.addItem ("April");
		month.addItem ("May");
		month.addItem ("June");
		month.addItem ("July");
		month.addItem ("August");
		month.addItem ("September");
		month.addItem ("October");
		month.addItem ("November");
		month.addItem ("December");
		month.select (thisMonth);
		add (month);

		year = new TextField ("" + thisYear, 4);
		add (year);

		next = new Button ("Next Month");
		add (next);

		screenG = getGraphics ();
		metrics = screenG.getFontMetrics ();
	}

	public void paint (Graphics g)
	{
		if (screenG != null)
		{
			// the following three lines are workarounds for NetScape 2.0 bugs.
			Point		p = month.location ();
			g.clearRect (0, 0, dimension.width, dimension.height);
			month.move (p.x, (p.y & -2) + (selectedMonth & 1));

			doMonth (selectedMonth, selectedYear);
		}
	}

	public void setYear (int y)
	{
		if (y > 999)
			year.setText ("" + y);
		else if (y > 99)
			year.setText ("0" + y);
		else if (y > 9)
			year.setText ("00" + y);
		else
			year.setText ("000" + y);
	}

	public boolean action (Event e, Object o)
	{
		if (e.target == previous)
		{
			if ((selectedYear > 1) || (selectedMonth > 0))
			{
				selectedMonth--;
				if (selectedMonth < 0)
				{
					selectedMonth = 11;
					selectedYear--;
				}

				month.select (selectedMonth);
				setYear (selectedYear);
				repaint ();
			}

			return (true);
		}

		if (e.target == next)
		{
			if ((selectedYear < 9999) || (selectedMonth < 11))
			{
				selectedMonth++;
				if (selectedMonth > 11)
				{
					selectedMonth = 0;
					selectedYear++;
				}

				month.select (selectedMonth);
				setYear (selectedYear);
				repaint ();
			}

			return (true);
		}

		if (e.target == month)
		{
			int		m = month.getSelectedIndex ();

			setYear (selectedYear);

			if (m != selectedMonth)
			{
				selectedMonth = month.getSelectedIndex ();
				repaint ();
			}

			return (true);
		}

		if (e.target == year)
		{
			int		y = parseYear (year.getText ());

			if ((y > 0) && (y != selectedYear))
			{
				selectedYear = y;
				repaint ();
			}

			return (true);
		}

		return (false);
	}

	public boolean handleEvent (Event e)
	{
		if (e.target == year)
		{
			int		y = parseYear (year.getText ());

			if ((y > 0) && (y != selectedYear))
			{
				selectedYear = y;
				repaint ();
			}
		}

		return super.handleEvent (e);
	}
}