日期:2014-05-20  浏览次数:20665 次

java question!
compose   a   java   class   having   relevant   operation   that   shows   a   calender   for   a   year   and   months.   inpur   for   year   and   months   are   by   parameter.

example:

          SEPTEMBER   2007
sun   mon   tue   wed     thu   fri     sat
                1         2           3           4         5       6
    7         8         9           10       11     12     13
  14       15     16         17       18       19     20
  21       22     23         24       25       26     27
  28       29     30

thanks


------解决方案--------------------
Why not using chinese to ask question?
Here is a example.I hope it could suit to your requirement ! GOOD LUCK~-.-

import java.text.*;
import java.util.*;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.*;

public final class winDateChoose
extends JPanel {

private static final long serialVersionUID = 1L;

private static final int startX = 10;

private static final int startY = 60;

private static final Font smallFont = new Font( "Arial ", Font.PLAIN, 10);

private static final Font largeFont = new Font( "Arial ", Font.PLAIN, 12);

private static final Insets insets = new Insets(2, 2, 2, 2);

private static final Color highlight = new Color(255, 0, 0);

private static final Color white = new Color(255, 255, 255);

private static final Color gray = new Color(204, 204, 204);

private Component selectedDay = null;

private GregorianCalendar selectedDate = null;

private GregorianCalendar originalDate = null;

private boolean hideOnSelect = true;

private final JButton backButton = new JButton();

private final JLabel monthAndYear = new JLabel();

private final JButton forwardButton = new JButton();
private JDialog mParentWin;
public boolean mOkClick = false;
public boolean mTimeShowFlag = true;

private final JLabel[] dayHeadings = new JLabel[] {
new JLabel( "Sun "),
new JLabel( "Mon "),
new JLabel( "Tur "),
new JLabel( "Wen "),
new JLabel( "Thu "),
new JLabel( "Fri "),
new JLabel( "Sat ")};

private final JLabel[][] daysInMonth = new JLabel[][] {
{
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel()}
, {
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel()}
, {
new JLabel(),
new JLabel(),
new JLabel(),
new JLabel(),