我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

java黄历代码 日历java代码

用java控制台实现万年历-要求打印当前年月日的日历表格,要求对当天的日期单独标示

以下是用java swing编写的日历,很好用,在我所做的系统里就能够正常的使用

创新互联是网站建设专家,致力于互联网品牌建设与网络营销,专业领域包括网站设计、网站制作、电商网站制作开发、小程序开发、微信营销、系统平台开发,与其他网站设计及系统开发公司不同,我们的整合解决方案结合了恒基网络品牌建设经验和互联网整合营销的理念,并将策略和执行紧密结合,且不断评估并优化我们的方案,为客户提供全方位的互联网品牌整合方案!

接下来 是具体代码:

package Demo;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.FlowLayout;

import java.awt.Font;

import java.awt.Frame;

import java.awt.GridLayout;

import java.awt.Point;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Calendar;

import java.util.Date;

import javax.swing.JButton;

import javax.swing.JDialog;

import javax.swing.JFrame;

import javax.swing.JFormattedTextField;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JSpinner;

import javax.swing.SpinnerNumberModel;

import javax.swing.SwingConstants;

import javax.swing.SwingUtilities;

import javax.swing.border.LineBorder;

import javax.swing.event.ChangeEvent;

import javax.swing.event.ChangeListener;

public class DateChooser extends JPanel implements ActionListener,

ChangeListener {

/**

*

*/

private static final long serialVersionUID = 1L;

int startYear = 1980;

int lastYear = 2050;

int width = 270;

int height = 200;

Color backGroundColor = Color.gray;

Color palletTableColor = Color.white;

Color todayBackColor = Color.orange;

Color weekFontColor = Color.blue;

Color dateFontColor = Color.black;

Color weekendFontColor = Color.red;

Color controlLineColor = Color.pink;

Color controlTextColor = Color.white;

Color rbFontColor = Color.white;

Color rbBorderColor = Color.red;

Color rbButtonColor = Color.pink;

Color rbBtFontColor = Color.red;

JDialog dialog;

JSpinner yearSpin;

JSpinner monthSpin;

JSpinner hourSpin;

JSpinner minuteSpin;

JButton[][] daysButton = new JButton[6][7];

JFormattedTextField jFormattedTextField;

Calendar c = getCalendar();

DateChooser(JFormattedTextField jftf) {

jFormattedTextField = jftf;

setLayout(new BorderLayout());

setBorder(new LineBorder(backGroundColor, 2));

setBackground(backGroundColor);

JPanel topYearAndMonth = createYearAndMonthPanal();

add(topYearAndMonth, BorderLayout.NORTH);

JPanel centerWeekAndDay = createWeekAndDayPanal();

add(centerWeekAndDay, BorderLayout.CENTER);

}

private JPanel createYearAndMonthPanal() {

int currentYear = c.get(Calendar.YEAR);

int currentMonth = c.get(Calendar.MONTH) + 1;

int currentHour = c.get(Calendar.HOUR_OF_DAY);

int currentMinute = c.get(Calendar.MINUTE);

JPanel result = new JPanel();

result.setLayout(new FlowLayout());

result.setBackground(controlLineColor);

yearSpin = new JSpinner(new SpinnerNumberModel(currentYear, startYear,

lastYear, 1));

yearSpin.setPreferredSize(new Dimension(48, 20));

yearSpin.setName("Year");

yearSpin.setEditor(new JSpinner.NumberEditor(yearSpin, "####"));

yearSpin.addChangeListener(this);

result.add(yearSpin);

JLabel yearLabel = new JLabel("年");

yearLabel.setForeground(controlTextColor);

result.add(yearLabel);

monthSpin = new JSpinner(new SpinnerNumberModel(currentMonth, 1, 12, 1));

monthSpin.setPreferredSize(new Dimension(35, 20));

monthSpin.setName("Month");

monthSpin.addChangeListener(this);

result.add(monthSpin);

JLabel monthLabel = new JLabel("月");

monthLabel.setForeground(controlTextColor);

result.add(monthLabel);

hourSpin = new JSpinner(new SpinnerNumberModel(currentHour, 0, 23, 1));

hourSpin.setPreferredSize(new Dimension(35, 20));

hourSpin.setName("Hour");

hourSpin.addChangeListener(this);

result.add(hourSpin);

JLabel hourLabel = new JLabel("时");

hourLabel.setForeground(controlTextColor);

result.add(hourLabel);

minuteSpin = new JSpinner(new SpinnerNumberModel(currentMinute, 0, 59,

1));

minuteSpin.setPreferredSize(new Dimension(35, 20));

minuteSpin.setName("Minute");

minuteSpin.addChangeListener(this);

result.add(minuteSpin);

JLabel minuteLabel = new JLabel("分");

minuteLabel.setForeground(controlTextColor);

result.add(minuteLabel);

return result;

}

private JPanel createWeekAndDayPanal() {

String colname[] = { "日", "一", "二", "三", "四", "五", "六" };

JPanel result = new JPanel();

result.setFont(new Font("宋体", Font.PLAIN, 12));

result.setLayout(new GridLayout(7, 7));

result.setBackground(Color.white);

JLabel cell;

for (int i = 0; i 7; i++) {

cell = new JLabel(colname[i]);

cell.setHorizontalAlignment(JLabel.CENTER);

if (i == 0 || i == 6)

cell.setForeground(weekendFontColor);

else

cell.setForeground(weekFontColor);

result.add(cell);

}

int actionCommandId = 0;

for (int i = 0; i 6; i++)

for (int j = 0; j 7; j++) {

JButton numberButton = new JButton();

numberButton.setBorder(null);

numberButton.setHorizontalAlignment(SwingConstants.CENTER);

numberButton.setActionCommand(String.valueOf(actionCommandId));

numberButton.addActionListener(this);

numberButton.setBackground(palletTableColor);

numberButton.setForeground(dateFontColor);

if (j == 0 || j == 6)

numberButton.setForeground(weekendFontColor);

else

numberButton.setForeground(dateFontColor);

daysButton[i][j] = numberButton;

numberButton.addMouseListener(new MouseAdapter() {

public void mouseClicked(MouseEvent e) {

if (e.getClickCount() == 2) {

closeAndSetDate();

}

}

});

result.add(numberButton);

actionCommandId++;

}

return result;

}

private JDialog createDialog(Frame owner) {

JDialog result = new JDialog(owner, "日期时间选择", true);

result.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);

result.getContentPane().add(this, BorderLayout.CENTER);

result.pack();

result.setSize(width, height);

return result;

}

public void showDateChooser(Point position) {

Object tmpobj=SwingUtilities.getWindowAncestor(jFormattedTextField);

if(tmpobj.getClass().isInstance(new JDialog())||tmpobj.getClass().getSuperclass().isInstance(new JDialog()))

{

JDialog ownerdialog = (JDialog) SwingUtilities

.getWindowAncestor(jFormattedTextField);

Frame owner = (Frame) SwingUtilities.getWindowAncestor(ownerdialog);

if (dialog == null || dialog.getOwner() != owner) {

dialog = createDialog(owner);

}

dialog.setLocation(getAppropriateLocation(owner, position));

}

else if(tmpobj.getClass().isInstance(new JFrame())||tmpobj.getClass().getSuperclass().isInstance(new JFrame()))

{

JFrame ownerFrame = (JFrame) SwingUtilities

.getWindowAncestor(jFormattedTextField);

if (dialog == null || dialog.getOwner() != ownerFrame) {

dialog = createDialog(ownerFrame);

}

dialog.setLocation(getAppropriateLocation(ownerFrame, position));

}

flushWeekAndDay();

dialog.setVisible(true);

}

Point getAppropriateLocation(Frame owner, Point position) {

Point result = new Point(position);

Point p = owner.getLocation();

int offsetX = (position.x + width) - (p.x + owner.getWidth());

int offsetY = (position.y + height) - (p.y + owner.getHeight());

if (offsetX 0) {

result.x -= offsetX;

}

if (offsetY 0) {

result.y -= offsetY;

}

return result;

}

public void closeAndSetDate() {

setDate(c.getTime());

dialog.dispose();

}

private Calendar getCalendar() {

Calendar result = Calendar.getInstance();

result.setTime(getDate());

return result;

}

private int getSelectedYear() {

return ((Integer) yearSpin.getValue()).intValue();

}

private int getSelectedMonth() {

return ((Integer) monthSpin.getValue()).intValue();

}

private int getSelectedHour() {

return ((Integer) hourSpin.getValue()).intValue();

}

private int getSelectedMinute() {

return ((Integer) minuteSpin.getValue()).intValue();

}

private void dayColorUpdate(boolean isOldDay) {

int day = c.get(Calendar.DAY_OF_MONTH);

c.set(Calendar.DAY_OF_MONTH, 1);

int actionCommandId = day - 2 + c.get(Calendar.DAY_OF_WEEK);

int i = actionCommandId / 7;

int j = actionCommandId % 7;

if (isOldDay)

daysButton[i][j].setForeground(dateFontColor);

else

daysButton[i][j].setForeground(todayBackColor);

}

private void flushWeekAndDay() {

c.set(Calendar.DAY_OF_MONTH, 1);

int maxDayNo = c.getActualMaximum(Calendar.DAY_OF_MONTH);

int dayNo = 2 - c.get(Calendar.DAY_OF_WEEK);

for (int i = 0; i 6; i++) {

for (int j = 0; j 7; j++) {

String s = "";

if (dayNo = 1 dayNo = maxDayNo)

s = String.valueOf(dayNo);

daysButton[i][j].setText(s);

dayNo++;

}

}

dayColorUpdate(false);

}

public void stateChanged(ChangeEvent e) {

JSpinner source = (JSpinner) e.getSource();

if (source.getName().equals("Minute")) {

c.set(Calendar.MINUTE, getSelectedMinute());

return;

}

if (source.getName().equals("Hour")) {

c.set(Calendar.HOUR_OF_DAY, getSelectedHour());

return;

}

dayColorUpdate(true);

if (source.getName().equals("Year")) {

c.set(Calendar.YEAR, getSelectedYear());

}

if (source.getName().equals("Month")) {

c.set(Calendar.MONTH, getSelectedMonth() - 1);

}

flushWeekAndDay();

}

public void actionPerformed(ActionEvent e) {

JButton source = (JButton) e.getSource();

if (source.getText().length() == 0)

return;

dayColorUpdate(true);

source.setForeground(todayBackColor);

int newDay = Integer.parseInt(source.getText());

c.set(Calendar.DAY_OF_MONTH, newDay);

}

public void setDate(Date date) {

jFormattedTextField.setText(getDefaultDateFormat().format(date));

}

public Date getDate() {

try {

String dateString = jFormattedTextField.getText();

return getDefaultDateFormat().parse(dateString);

} catch (ParseException e) {

return getNowDate();

} catch (Exception ee) {

return getNowDate();

}

}

private static Date getNowDate() {

return Calendar.getInstance().getTime();

}

private static SimpleDateFormat getDefaultDateFormat() {

return new SimpleDateFormat("yyyy-MM-dd HH:mm");

}

}

测试程序:

package Demo;

import java.awt.Point;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFormattedTextField;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

public class DemoForDateChooser extends JFrame {

private JFormattedTextField formattedTextField;

/**

* Launch the application

* @param args

*/

public static void main(String args[]) {

try {

DemoForDateChooser frame = new DemoForDateChooser();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

}

}

/**

* Create the frame

*/

public DemoForDateChooser() {

super();

setTitle("日期选择框");

getContentPane().setLayout(null);

setBounds(100, 100, 383, 137);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JPanel panel = new JPanel();

panel.setLayout(null);

panel.setBounds(0, 0, 375, 107);

getContentPane().add(panel);

formattedTextField = new JFormattedTextField();

formattedTextField.setBounds(68, 48, 175, 23);

final JButton button = new JButton();

button.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

DateChooser mDateChooser=new DateChooser(formattedTextField);

Point p = button.getLocationOnScreen();

p.y = p.y + 30;

mDateChooser.showDateChooser(p);

formattedTextField.requestFocusInWindow();

}

});

button.setText("选择日期");

button.setBounds(249, 47, 99, 23);

panel.add(button);

final JLabel label = new JLabel();

label.setText("日期:");

label.setBounds(10, 47, 71, 23);

panel.add(label);

panel.add(formattedTextField);

//

}

}

求Java万年历源代码!!!

我有个JS的要么?

你可以把他改下我是没时间帮你该哈!!!

!--日期框选择--

var DS_x,DS_y;

function dateSelector() //构造dateSelector对象,用来实现一个日历形式的日期输入框。

{

var myDate=new Date();

this.year=myDate.getFullYear(); //定义year属性,年份,默认值为当前系统年份。

this.month=myDate.getMonth()+1; //定义month属性,月份,默认值为当前系统月份。

this.date=myDate.getDate(); //定义date属性,日,默认值为当前系统的日。

this.inputName=''; //定义inputName属性,即输入框的name,默认值为空。注意:在同一页中出现多个日期输入框,不能有重复的name!

this.display=display; //定义display方法,用来显示日期输入框。

}

function display() //定义dateSelector的display方法,它将实现一个日历形式的日期选择框。

{

var week=new Array('日','一','二','三','四','五','六');

document.write("style type=text/css");

document.write(" .ds_font td,span { font: normal 12px 宋体; color: #000000; }");

document.write(" .ds_border { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");

document.write(" .ds_border2 { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");

document.write("/style");

var M=new String(this.month);

var d=new String(this.date);

if(M.length==1d.length==1){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-0"+this.month+"-0"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

else if(M.length==1d.length==2){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-0"+this.month+"-"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

else if(M.length==2d.length==1){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-0"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

else if(M.length==2d.length==2){

document.write("input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly");}

document.write("button style='width:60px;height:18px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#DFE7EF;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()日期/button");

document.write("div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'");

document.write(" div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D;' class=ds_font");

document.write(" table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'");

document.write(" tr align=center");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='减小年份'/td");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subMonth(this) title='减小月份'/td");

document.write(" td width=52%b"+this.year+"/bb年/bb"+this.month+"/bb月/b/td");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addMonth(this) title='增加月份'/td");

document.write(" td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addYear(this) title='增加年份'/td");

document.write(" /tr");

document.write(" /table");

document.write(" table cellpadding=0 cellspacing=0 width=140 height=20 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'");

document.write(" tr align=center");

for(i=0;i7;i++)

document.write(" td"+week[i]+"/td");

document.write(" /tr");

document.write(" /table");

document.write(" table cellpadding=0 cellspacing=2 width=140 bgcolor=#EEEEEE");

for(i=0;i6;i++)

{

document.write(" tr align=center");

for(j=0;j7;j++)

document.write(" td width=10% height=16 onmouseover=if(this.innerText!=''this.className!='ds_border2')this.className='ds_border' onmouseout=if(this.className!='ds_border2')this.className='' onclick=getValue(this,document.all('DS_"+this.inputName+"'))/td");

document.write(" /tr");

}

document.write(" /table");

document.write(" span style=cursor:hand onclick=this.parentNode.parentNode.style.display='none'【关闭】/span");

document.write(" /div");

document.write("/div");

dateShow(document.all("DS_"+this.inputName).nextSibling.nextSibling.childNodes[0].childNodes[2],this.year,this.month)

}

function subYear(obj) //减小年份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

myObj[0].innerHTML=eval(myObj[0].innerHTML)-1;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function addYear(obj) //增加年份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

myObj[0].innerHTML=eval(myObj[0].innerHTML)+1;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function subMonth(obj) //减小月份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

var month=eval(myObj[2].innerHTML)-1;

if(month==0)

{

month=12;

subYear(obj);

}

myObj[2].innerHTML=month;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function addMonth(obj) //增加月份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

var month=eval(myObj[2].innerHTML)+1;

if(month==13)

{

month=1;

addYear(obj);

}

myObj[2].innerHTML=month;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function dateShow(obj,year,month) //显示各月份的日

{

var myDate=new Date(year,month-1,1);

var today=new Date();

var day=myDate.getDay();

var selectDate=obj.parentNode.parentNode.previousSibling.previousSibling.value.split('-');

var length;

switch(month)

{

case 1:

case 3:

case 5:

case 7:

case 8:

case 10:

case 12:

length=31;

break;

case 4:

case 6:

case 9:

case 11:

length=30;

break;

case 2:

if((year%4==0)(year%100!=0)||(year%400==0))

length=29;

else

length=28;

}

for(i=0;iobj.cells.length;i++)

{

obj.cells[i].innerHTML='';

obj.cells[i].style.color='';

obj.cells[i].className='';

}

for(i=0;ilength;i++)

{

obj.cells[i+day].innerHTML=(i+1);

if(year==today.getFullYear()(month-1)==today.getMonth()(i+1)==today.getDate())

obj.cells[i+day].style.color='red';

if(year==eval(selectDate[0])month==eval(selectDate[1])(i+1)==eval(selectDate[2]))

obj.cells[i+day].className='ds_border2';

}

}

function getValue(obj,inputObj) //把选择的日期传给输入框

{

var myObj=inputObj.nextSibling.nextSibling.childNodes[0].childNodes[0].cells[2].childNodes;

if(obj.innerHTML)

if(obj.innerHTML.length==1myObj[2].innerHTML.length==1)

inputObj.value=myObj[0].innerHTML+"-0"+myObj[2].innerHTML+"-0"+obj.innerHTML;

else if(obj.innerHTML.length==1myObj[2].innerHTML.length==2)

inputObj.value=myObj[0].innerHTML+"-"+myObj[2].innerHTML+"-0"+obj.innerHTML;

else if(obj.innerHTML.length==2myObj[2].innerHTML.length==1)

inputObj.value=myObj[0].innerHTML+"-0"+myObj[2].innerHTML+"-"+obj.innerHTML;

else if(obj.innerHTML.length==2myObj[2].innerHTML.length==2)

inputObj.value=myObj[0].innerHTML+"-"+myObj[2].innerHTML+"-"+obj.innerHTML;

inputObj.nextSibling.nextSibling.style.display='none';

for(i=0;iobj.parentNode.parentNode.parentNode.cells.length;i++)

obj.parentNode.parentNode.parentNode.cells[i].className='';

obj.className='ds_border2'

}

function dsMove(obj) //实现层的拖移

{

if(event.button==1)

{

var X=obj.clientLeft;

var Y=obj.clientTop;

obj.style.pixelLeft=X+(event.x-DS_x);

obj.style.pixelTop=Y+(event.y-DS_y);

}

}

/***调用代码**

script language=javascript

var myDate=new dateSelector();

myDate.year=1900;//morenqiri

myDate.inputName='date'; //

myDate.display();

/script

*/

问:编写 万年历java代码例如1900年一月一日是星期一。用for if 语句

import java.util.Calendar;

import java.util.Date;

import java.util.Scanner;

public class MyCalendar

{

public static void main(String[] args)

{

Scanner scanner = new Scanner(System.in);

String reg = "^(\\d+)[^\\d]+((0?[1-9])|(1[012]))$";

while(true)

{

System.out.println("输入年月(年和月用非数字隔开:如2015.1)(什么都不输入直接退出)");

String line = scanner.nextLine().trim();

if("".equals(line))

{

scanner.close();

break;

}

if(!line.matches(reg))

{

continue;

}

int year = Integer.parseInt(line.replaceAll(reg, "$1"));

int month = Integer.parseInt(line.replaceAll(reg, "$2"));

System.out.println("日\t一\t二\t三\t四\t五\t六");

Calendar calendar = Calendar.getInstance();

// 这个月的1号是星期几

calendar.set(year, month - 1, 1);

int day = calendar.get(Calendar.DAY_OF_WEEK);

int start = Calendar.SUNDAY;

calendar.add(Calendar.DATE, -day + start);

while(start  day)

{

System.out.print(calendar.get(Calendar.DATE) + "\t");

calendar.add(Calendar.DATE, 1);

start++;

}

calendar.set(year, month - 1, 1);

Date now = calendar.getTime();

calendar.set(year, month, 1);

Date next = calendar.getTime();

for(Date cur = now; cur.before(next);)

{

calendar.setTime(cur);

int x = calendar.get(Calendar.DATE);

String tmp = x  10 ? "0" + x : x + "";

System.out.print(tmp + "\t");

if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)

{

System.out.println();

}

calendar.add(Calendar.DATE, 1);

cur = calendar.getTime();

}

calendar.add(Calendar.DATE, -1);

int to = calendar.get(Calendar.DAY_OF_WEEK);

int end = Calendar.SATURDAY;

while(to  end)

{

calendar.add(Calendar.DATE, 1);

int x = calendar.get(Calendar.DATE);

String tmp = x  10 ? "0" + x : x + "";

System.out.print(tmp + "\t");

to++;

}

System.out.println();

}

}

}


网站标题:java黄历代码 日历java代码
转载源于:http://shouzuofang.com/article/ddddeoj.html

其他资讯