求jsp日历(calendar)代码,click后能选择周
发布时间:2025-05-24 21:28:49 发布人:远客网络
一、求jsp日历(calendar)代码,click后能选择周
public class CalendarV2 extends Applet{
private boolean isStandalone= false;
public String getParameter(String key, String def){
return isStandalone? System.getProperty(key, def):
(getParameter(key)!= null? getParameter(key): def);
private void jbInit() throws Exception{
jLabel1.setText("Please Enter Year");
jLabel1.setBounds(new Rectangle(8, 30, 114, 26));
jTextField1.setBounds(new Rectangle(129, 30, 136, 27));
jLabel2.setText("Please Ente Month");
jLabel2.setBounds(new Rectangle(4, 70, 104, 26));
jTextField2.setBounds(new Rectangle(130, 69, 136, 26));
jButton1.setBounds(new Rectangle(16, 122, 233, 21));
jButton1.setText("CheckCalendarV2");
jButton1.addActionListener(new CalendarV2_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(16, 156, 232, 20));
jButton2.addActionListener(new CalendarV2_jButton2_actionAdapter(this));
JTextField jTextField1= new JTextField();
JTextField jTextField2= new JTextField();
JButton jButton1= new JButton();
public String getAppletInfo(){
public String[][] getParameterInfo(){
public static void main(String[] args){
CalendarV2 applet= new CalendarV2();
frame.setTitle("Applet Frame");
frame.add(applet, BorderLayout.CENTER);
Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width- frame.getSize().width)/ 2,(d.height- frame.getSize().height)/ 2);
boolean isLeapYear,isEverPressBtn=false;
int thisYear,EnterYear,EnterMonth;
//***********************************************************************************
//***********************************************************************************
//-----计算该年天数---------------
public int checkYear(int Year){
//--------------------------------
//------查看是否闰年----------------
public boolean checkLeapYear(int Year){
//---------------------------------
//--------计算当月天数---------------
//要输入年份的原因是要判断二月29天还是28天
public int checkMonth(int Month,int Year){
System.out.println("Month Error");
if(Month==1||Month==3||Month==5||
Month==7||Month==8||Month==10||
if(Month==2&&this.checkLeapYear(Year)){
if(Month==2&&!this.checkLeapYear(Year)){
if(Month==4||Month==6||Month==9||Month==11){
//------------------------------------
//-----用递归法计算目标年到已知年的总天数---
public int counterYearDates(int EnterYear){
if(EnterYear==2001){//2001年为已知年
sum1+=this.checkYear(EnterYear-1)
+this.counterYearDates(EnterYear-1);
//当目标年大于2001年,则从目标年-1往前累加
sum1+=this.checkYear(EnterYear)
+this.counterYearDates(EnterYear+1);
//当目标年小于2001年,则从目标年往后累加
//-----计算目标年从一月到目标月的总天数------------------------
//要输入年份的原因是要判断二月29天还是28天
public int counterMonthDates(int EnterMonth,int EnterYear){
if(EnterMonth>1&&EnterMonth<=12){
sum2+=this.checkMonth(EnterMonth-1,EnterYear)
+this.counterMonthDates(EnterMonth-1,EnterYear);
System.out.print("Month Error");
//------------------------------------------------
//-------------用数组存目标月日期-----------------------------
public int[] Array(int AllDates,int EnterMonth){
if(n<0)//Keep the n bigger than 0
n=7+n+1;//Line 207 haven´t add 1,so here add
for(int i=n;i<this.checkMonth(EnterMonth,EnterYear)+n;i++){
for(int i=7;i<this.checkMonth(EnterMonth,EnterYear)+7;i++){
//若n为0,则说明目标月一号为星期日
//----------------------------------------------------------
//-----------打印输出-------------------------------
public void printTable(int[]DayInTable){
System.out.println("Curren Date is: Year"
+EnterYear+" Month"+EnterMonth);
System.out.print("Mon Tue Wed Thur Fri Sat Sun");
if(i%7==0&&DayInTable[i]!=0){//防止在最后i=35时输出0
System.out.print(DayInTable[i]+"");
System.out.print(DayInTable[i]+"");
else if(DayInTable[i]!=0)//防止在最后i<9时输出0
System.out.print(DayInTable[i]+"");
//-----------------------------------------------------
//---------------按钮触发事件---------------------
void jButton1_actionPerformed(ActionEvent e){
***********refresh Datas******************
Dates=0;AllDates=0;sum1=0;sum2=0;thisYear=0;
/*如果这几个变量在方法里声明,则不用刷新,请看CalendarV2*/
/******Left All Datas go back to 0****/
EnterYear=Integer.parseInt(a);
EnterMonth=Integer.parseInt(b);
AllDates=this.counterYearDates(EnterYear)
+this.counterMonthDates(EnterMonth,EnterYear)+1;
AllDates=-this.counterYearDates(EnterYear)
+this.counterMonthDates(EnterMonth,EnterYear);
System.out.print("Year Error");
printTable(Array(AllDates,EnterMonth));
JButton jButton2= new JButton();
void jButton2_actionPerformed(ActionEvent e){
//--------------------------------------------------------
//***********************************************************************************
//***********************************************************************************
class CalendarV2_jButton1_actionAdapter implements java.awt.event.ActionListener{
CalendarV2_jButton1_actionAdapter(CalendarV2 adaptee){
public void actionPerformed(ActionEvent e){
adaptee.jButton1_actionPerformed(e);
class CalendarV2_jButton2_actionAdapter implements java.awt.event.ActionListener{
CalendarV2_jButton2_actionAdapter(CalendarV2 adaptee){
public void actionPerformed(ActionEvent e){
adaptee.jButton2_actionPerformed(e);
二、stend的用法
1/ stænd; stænd/ n
[sing] stationary condition; halt or standstill停止的状态;中止;停顿: come to a stand停下来.
[sing] position taken up; act or instance of standing立脚点;站立: He took his stand(ie stood) near the window.他站在窗旁.
[C](period of time of) resistance to attack抵抗;抵御;抵抗时期: the rebels' last stand叛乱者的最后抵抗* a stand of sixty days六十天的抵抗.
[C](often in compounds常用以构成复合词) small piece of furniture(eg a rack, pedestal, frame, etc) on or in which sth may be placed(置物的)架,座,台: a `hat/an um`brella/a `coat stand帽[伞/衣]架* a `cake stand糕饼架* a `music-stand, ie for supporting sheet music while it is being played乐谱架.
[C](a) structure(eg a table or kiosk) from which goods are sold; stall货摊;售货亭: a `news-stand报摊* a market stand集市的货摊.(b) area or structure where things are displayed, exhibited, advertised, etc摊位(用於陈列、展览、宣传等目的的): one of the stands at a book fair书展中的一个摊位.
[C] place where vehicles may stand in a line in a street, etc while waiting for passengers(街道等处的)车辆候客处: a `taxi-stand计程车站* a stand for six taxis有六个车位的计程车候客处.
[C often pl常作复数] large, usu sloping, structure at a sports ground, racecourse etc, with rows of seats for spectators看台: A cheer rose from the south stand(s).南看台上响起一片欢呼声.=>illus at Association football(association)见Association football(association)插图. Cf参看 grandstand(grand).
[C] stop made for a performance by a touring theatrical company, pop group, etc(巡回演出的剧团、流行乐乐队等的)停留演出: a series of,one-night `stands演一晚换一处的巡回演出.
[C usu sing通常作单数](US) witness-box(in a lawcourt)证人席: take the stand作证.
(idm习语) make a stand(against/for sth/sb) be ready to resist, fight, argue, etc准备抵抗、格斗、争论等: make a stand against the enemy摆开架势迎击敌人* make a stand for one's principles准备为维护自己的原则而争斗. take a/one's stand(on sth) declare one's position, opinion, etc(on sth)宣布(对某事物的)立场、意见等;表明态度: She took a firm stand on nuclear disarmament.她在核裁军的问题上态度很坚决. stand 2
/ stænd; stænd/ v(pt, pp stood/ stud; stʊd/)
* UPRIGHT POSITION OR EXTENSION直立的姿势或状态
[I] have, take or keep an upright position站立;直立;站着: She was too weak to stand.她虚弱得站不起来.* A chair will not stand on two legs.椅子只用两条腿着地是立不住的.* Don't stand there arguing about it.不要站在那儿争论这件事.* Stand still while I take your photograph.我给你拍照时,站着不要动.* After the bombing only a few houses were left standing.轰炸之后,只剩下几所房子没倒塌.
[I, Ip]~(up) rise to one's feet起立;站起来: Everyone stood(up) when the Queen entered.女王进来时大家都站起来了.* We stood(up) to see better.我们站了起来,好看得清楚些.* Stand up, please!请起立!
[Tn.pr, Tn.p] put(sth/sb) in an upright position; place使(某物[某人])直立;放置: Don't stand cans of petrol near the fire.不要把汽油罐放在近火处.* Stand the ladder(up/upright) against the wall.把梯子竖起来靠在墙上.* I stood the child on a stool so that she could reach the shelf.我把孩子抱到凳子上,她就能够到那架子了.
[In/pr] have a specified height高度为...: He stands six foot two.他身高六英尺二英寸.* The tower stands fifty metres.这座塔高五十米.
* BEING OR REMAINING IN A PLACE OR CONDITION处於某地方或某状况
[I] be in a certain place; be situated在某处;位於: a clock standing on the sideboard在餐具柜上的钟* A tall poplar tree once stood here.这儿曾经有过一棵高大的白杨树.*(fig比喻) Where do you stand(ie What is your opinion) on these issues?对这些问题你有什麽看法?
[I](of a vehicle, etc) remain in the same place(指车辆等)停着: a train standing in the station停在车站里的火车* The car stood at the traffic lights for a few moments, then moved off.那辆汽车在交通灯前停了一会儿,然后驶去了.
[I] remain unchanged; remain valid维持原状;保持效力: Let the words stand.不要改动这些字.* The agreement must stand, ie cannot be altered or cancelled.这合约决不能动.* My offer still stands.我提出的愿效劳的想法仍然未变.
(a) [La, Ln, I] be in a certain condition or situation处於某种状态或情形: The house has stood empty for months.那所房子空了几个月了.* The emergency services stand(ie are) ready to help if necessary.紧急救难处随时可以驰援.* She stood convicted of fraud.她被判犯有诈骗罪.* I stand corrected, ie accept that I was mistaken and that the person who corrected me is right.我接受指正.* She stands high in the esteem of(ie is greatly respected by) her colleagues.她深受同事的尊敬.*(fml文) Will you stand(ie be) godmother to the child?你愿意做这个孩子的教母吗?* As things stand, there is little chance of a settlement in the dispute.就目前情况看,解决这一纠纷的希望不大.(b) [Ipr]~ at sth be at a certain level, point of a scale, etc处於某水平;指向某一点: The clock stands at ten to four.那个钟上的时间是三点五十分.* The fund stands at 500, ie there is 500 in it.这项基金有500英镑.
[It] be in a situation where one is likely to do sth看情形很可能做某事: stand to win, lose, gain, etc很可能赢、输、获利等* You stand to make a lot of money from this deal.你做这笔交易准能赚很多钱.
[I](of a liquid, mixture, etc) remain still; not flow or be disturbed(指液体、混合料等)处於静止状态,不流动: standing pools of rainwater一汪汪下雨积的水* Mix the batter and let it stand for twenty minutes.和好面糊,搁二十分钟.
[no passive不用於被动语态: Tn, Tt, Tg, Tsg](esp in negative sentences and in questions, with can/could; not in the continuous tenses尤用於否定句和疑问句中,与can/could连用,不用於进行时态) endure sth/sb; bear忍受某事物;容忍某人的行为;经受得起: He can't stand hot weather.他受不住炎热的天气.* My nerves won't stand the strain much longer.这麽紧张,我的神经快吃不消了.* She says she will stand no nonsense, ie will not put up with foolish behaviour.她说她决不容忍荒唐的行为.* I can't stand(ie I strongly dislike) him.我对他忍无可忍.* She couldn't stand to be told what to do.她不容别人指使她.* He can't stand being kept waiting.让他等着,他可不干.* I can't stand him interrupting all the time.他老是插嘴,真让我受不了.
[Tn no passive不用於被动语态, Dn.n] provide(sth) for sb at one's own expense自己付钱向某人提供(某物): stand drinks all round, ie pay for drinks for everyone请大家喝饮料* She was kind enough to stand us a meal.她慷慨地请我们吃了顿饭.
(esp Brit)(also esp US run) [I, Ipr]~(for sth) be a candidate in an election任候选人: She stood unsuccessfully in the local elections.她在地方选举中落选了.* stand for parliament为议会议员候选人* stand for President参加总统竞选.
[I, Ipr, Ip](nautical海) steer a specified course in a ship(船航行时)取某航向: stand westward(for the island)向西(朝着那个岛)航行.
(idm习语) stand well, etc with sb have a specified type of relationship with sb与某人相处得...: Do you stand well with your boss?你同上司相处得好吗?* I don't know how I stand with her.我不知道她对我有什麽看法.(For other idioms containing stand, see entries for ns, adjs, etc查阅与stand搭配的其他习语见有关名词、形容词等的词条,如 stand trial(for sth)=> trial; stand fast=> fast2.)
(phr v) stand a`side(a) move to one side站到一边去;让开: stand aside to let sb pass站在一边让某人通过.(b) take no part in events; do nothing不参与;不行动;不做事: Don't stand aside and let others do all the work.不要什麽都不干,事情都让别人做.(c) withdraw, eg as a candidate in an election退出(如竞选中): stand aside in favour of another applicant退出而有利於另一候选人.
stand `back(from sth)(a) move back退后;向后站: The policeman ordered us to stand back.警察命令我们向后退.(b) be situated away from sth位於与某物有一段距离的地方: The house stands back a little(from the road).那房子离公路有一段距离.
stand `by(a) be present but not do anything袖手旁观: How can you stand by and let him treat his dog like that?他那样虐待他那只狗,你怎麽能袖手旁观呢?(b) be ready for action准备行动: The troops are standing by.部队正严阵以待. stand by sb support or help sb支持或援助某人: I'll stand by you whatever happens.无论如何,我都支持你. stand by sth be faithful to(a promise,etc)信守(承诺等);遵守: She still stands by every word she said.她仍然信守自己说的每一句话.
stand `down(a)(of a witness) leave the witness-box in a lawcourt after giving evidence(指证人)(作证后)退出证人席.(b) withdraw(eg as a candidate in an election); resign from one's position退出(如竞选中);退职: The President has stood down after five years in office.总统执政五年后已经引退. stand(sb) `down(military军)(order sb to) relax after an alert(命令某人)解除戒备状态: The troops(were) stood down: it was a false alarm.部队解除了戒备状态,原来是虚惊一场.
`stand for sth(a)(no passive不用於被动语态) be an abbreviation of sth为某事物的缩略形式: What does`T. G.' stand for in `T. G. Smith'?在T. G. Smith中的T. G.是哪两个字的缩写?(b)(no passive不用於被动语态) represent sth代表某事物: I condemn fascism and all it stands for.我谴责法西斯主义及其代表的一切.(c)(no passive不用於被动语态) be in favour of sth; support sth赞同、支持或主张某事物: a party that stands for racial tolerance主张种族间互谅互让的政党.(d)(infml口) tolerate容忍;忍受: I won't stand for this insolence.我决不容忍这种傲慢无礼的行为.
stand `in(for sb) take sb's place; deputize代替某人;代表: My assistant will stand in for me while I'm away.我不在的时候我的助手将代表我处理事务.* Another man stands in for the big star in the dangerous scenes.拍摄危险的场景时,这位大明星有个替身.
stand `out(from/against sth) be easily seen; be noticeable突出;显眼: bright lettering that stands out well from/against a dark background由深色地衬托出很醒目的字. stand `out(from sb/sth) be much better than sb/sth远远超过某人[某事物]: Her work stands out from the rest as easily the best.她的工作成绩远比其他人都好. stand `out(against sth) continue to resist坚持抵抗: We managed to stand out against all attempts to close the company down.我们竭力顶住了要关闭公司的一切作法. stand out for sth(infml口) delay reaching an agreement in order to get what one wants拖延而暂不达成协议以期达到某目的: The nurses have been offered an extra 5%, but they're standing out for a 7% pay rise.当局答应给护士增加5%的工资,但她们坚持要得到7%的增幅.
stand over sb supervise or watch sb closely严密监督或监视某人: Don't stand over me while I am cooking.我做饭的时候别盯?我.* I hate to have my boss standing over me.我不喜欢上司监督我.
stand(sb) `to(order soldiers to) take up positions against an attack(命令士兵)进入阵地备战.
stand sb up(infml口) fail to keep an appointment with sb未如约与某人见面: First she agreed to come out with me, then she stood me up.她先是同意跟我出去,后来又爽约了. stand up for sb/sth speak, work, etc in favour of sb/sth; support sb/sth为某人[某事物]说话、工作等;支持某人[某事物]: Always stand up for your friends.要永远维护朋友的利益.* You must stand up for your rights.你一定要维护自己的权利. stand `up(to sth) withstand(a test, etc)经得起(考验等): Your argument just won't stand up(to close scrutiny).你的论点经不起(仔细)推敲. stand up to sb resist sb对抗某人: It was brave of her to stand up to those bullies.她挺身反抗那些恃强欺弱的人,真勇敢. stand up to sth(of materials, products, etc) remain in good condition in spite of(hard wear, etc)(指材料、产品等)经得起(磨损等): Will this car stand up to winter conditions here?这汽车经得起这儿冬天的气候条件吗?* This cloth is designed to stand up to a lot of wear and tear.这种布料十分耐用.
1 person or thing available as a substitute or in an emergency后备人员;备用的事物: Aspirin is a good stand-by for headaches.阿司匹林是必备的头痛良药.* [attrib作定语] a stand-by ticket, ie a cheaper type of airline ticket available when not all the tickets for a flight have been sold剩余机票(因未事先售出而价廉).
2(idm习语) on `stand-by in a state of readiness待命状态: The troops are on 24-hour stand-by, ie ready to move within 24 hours of receiving the order.部队待命24小时(接到命令后24小时内可行动).
`stand-in n person who acts as a deputy for or in place of sb else, esp one who takes the part of an actor in dangerous scenes替代者;(尤指演员做危险动作的)替身.
,stand-off `half(also `fly-half) one of the half-backs in Rugby football(英式橄榄球的)外侧前卫.
,stand-`offish adj cold and distant in behaviour; reserved; aloof冷漠的;冷淡的;矜持的. stand-offishlyadv. stand-offishness n [U].
`stand-up adj [attrib作定语] 1(of a meal) eaten while standing(指饭)站?吃的. 2(of a comedian) giving a performance which consists of standing in front of an audience and telling a series of jokes(指喜剧演员)说单口相声的: a stand-up comic单口相声演员. 3(of a fight, disagreement, etc) direct and violent(指打斗、争吵等)直接而激烈的: I had a stand-up row with my boss today.今天我跟上司大吵了一顿.