Java万年历实验报告_第1页
Java万年历实验报告_第2页
Java万年历实验报告_第3页
Java万年历实验报告_第4页
Java万年历实验报告_第5页
已阅读5页,还剩50页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Java课程实验报告

姓名:易乃杰

学号:2110505171

作业要求:

编写一个万年历程序,要求能够查询历史时间,能够添加、查看、

删除备忘录。

项目概述:

这个项目是一个简单的Java万年历,可以实现所有年份的公历日期的查询,

并且在相应的日期做备忘录,以及可以显示当前的日期以及时间。

程序截图:

具体功能介绍:

(1)万年历查询:点击图形界面中年份钱下拉框用来调整要查询的年份,点击

月份前来调整要查询的月份,然后可以看到这个月的每一天所对应的星期。

(2)Clock功能:在万年历下面显示当前的年月日时间,相当于一个时钟的功

能。

(3)记事本功能。

设计与实现(需要附全部代码,GUI自动生成代码除外):

1类的设计(继承、多态、数据结构):核心类是CalendarWindow.

findPassWordDialog等。

2Java10;文件访问

2GUI(用户界面):点下划线来表示GUI用户界面

6其他功能:(无)

程序代码:

packageapp;

importcalendar.CalendarWindow;

publicclassClient{

publicstaticvoidmain(String[]args)

newCalendarWindow().setVisible(true);

}

}

第一个包

packageaccount;

publicclassAccount{

privateStringname;

privateStringpassword;

publicAccount(Stringname,Stringpassword)

(

=name;

this.password=password;

}

publicStringgetName()

(

returnname;

}

publicvoidsetName(Stringname)

(

=name;

}

publicStringgetPassWord()

returnpassword;

}

publicvoidsetPassWord(Stringpassword)

this.password=password;

}

©Override

publicStringtoString(){

return"账户"+name+",密码"password;

}

©Override

publicbooleanequals(Objectobj){

if(this==obj)

returntrue;

if(obj==null)

returnfalse;

if(getClass()!=obj.getClass())

returnfalse;

Accountother=(Account)obj;

if(name==null){

if(!=null)

returnfalse;

}elseif(!name.equals())

returnfalse;

if(password==null){

if(other.passWord!=null)

returnfalse;

}elseif(!passWord.equals(other.passWord))

returnfalse;

returntrue;

}

)

第二个包(含三个类)

packagecalendar;

publicclassCalendarWindowextendsjavax.swing.JFrameimplements

Observer{

privateTimetime;

privateintyear;

privateintmonth;

privateintday;

privateWeekweek;

privateDatexcurrent;

privateILoginServiceloginService;

privatebooleanisLogin;

privatelEventServiceeventservice;

/**CreatesnewformTimeWindow*/

publicCalendarWindow(){

initComponents();

setLocationRelativeTo(null);

loginService=newLoginService();

eventService=newEventService();

init();

}

privatevoidinit(){

table.setGridColor(Color.GREEN);

table.setRowHeight(table.getRowHeight()*2+9);

time=newTime();

week=newWeek();

current=time.getSystemDate();

year=current.getYear();

month=current.getMonth();

day=current.getDay();

TimeUnitunit=time.getSystemTime();

hourText.setText(unit.getHour()+

secondText.setText(unit.getMinute()+"");

initTable(current);

initComboBox();

initlnfoTextArea(current);

}

//初始化ComboBox

privatevoidinitComboBox(){

for(inti=0;i<=20;i++)

yearComboBox.addltem(current.getYear()-10+i);

yearComboBox.setSelectedlndex(IO);

monthComboBox.setSelectedlndex(current.getMonth()-1);

}

//初始化TextArea

privatevoidinitlnfoTextArea(Datexdate){

infoTextArea.setFont(newFont("楷体",Font.BOLD,16));

infoTextArea.setLineWrap(true);

infoTextArea.setColumns(15);

infoTextArea.setRows(8);

infoTextArea.setTabSize(IO);

infoTextArea.setText("【龙年】\n\n"+date.toString()+"\n"

+week.getWeek(date)+"\n\n\n"+"【忌讳】:无\n\n\n"

+"【适宜】:无\n\n");

}

//初始化table

privatevoidinitTable(Datextoday){

DefaultTableModelmodel=newDefaultTableModel();

model.addColumn("星期日");

model.addColumn("星期一");

model.addColumn("星期二)

model.addColumn("星期三”);

model.addColumn("星期四");

model.addColumn("星期五");

model.addColumn("星期六");

Weeksweekl=week.getWeek(newDatex(today.getYear(),

today.getMonth(),

1));

Weeks[]weeks=Weeks.values();

intindex=0;

intnumx=1;

Object[]o=newObject[7];

for(inti=weeks.length-1;i>=0;i-){

if(weekl.equals(weeks[i]))

index=i;

}

for(intj=index;j<7;j++)

o[j]=numx++;

model.addRow(o);

for(inti=1;i<6;i++){

o=newObject[7];

for(intj=0;j<7;j++)

if(numx<=Uitll.lastday(today.getYear(),today.getMonth()))

o[j]=numx++;

model.addRow(o);

}

table.setModel(model);

}

privatevoidexitltemActionPerformed(java.awt.event.ActionEventevt){

System.exit(O);

}

privatevoidyearComboBoxActionPerformed(java.awt.event.ActionEvent

evt){

year=Integer.valueOf(yearComboBox.getSelectedltem().toString());

Datextemp=newDatex(year,month,1);

initTable(temp);

initlnfoTextArea(temp);

}

privatevoidmonthComboBoxActionPerformed(java.awt.event.ActionEvent

evt){

month=

lnteger.valueOf(monthComboBox.getSelectedltem().toString());

Datextemp=newDatex(year,month,1);

initTable(temp);

initlnfoTextArea(temp);

}

privatevoidtodayActionPerformed(java.awt.event.ActionEventevt){

initTable(time.getSystemDate());

initlnfoTextArea(current);

}

privatevoidloginButtonActionPerformed(java.awt.event.ActionEventevt){

isLogin=loginService.isOkOfLogin();

if(isLogin){

JOptionPane.showMessageDialog(this,"已登录,不能重复登录!");

return;

}

newloginDialog(this,loginService).setVisible(true);

isLogin=loginService.isOkOfLogin();

if(isLogin)

setTitle("万年历(登录状态:*已登录*)");

}

privatevoideventButtonActionPerformed(java.awt.event.ActionEventevt)

(

if(isLogin)

newEventDialog(this,new

Datex(year,month,day),eventservice).setVisible(true);

else{

JOptionPane.showMessageDialog(this,“个人文档已力口密,如需访问

请先登录!");

}

}

privatevoidtableMouseClicked(java.awt.event.MouseEventevt){

introw=table.getSelectedRow();

intcolumn=table.getSelectedColumn();

if(row<0||column<0)

return;

try(

table.setSelectionBackground(Color.WHITE);

table.setSelectionMode(1);

day=lnteger.valueOf(table.getValueAt(row,column).toStringQ);

initlnfoTextArea(newDatex(year,month,day));

}catch(Exceptione){

}

}

packagecalendar;

importdateandweek.Datex;

importuitl.Uitll;

publicclassCalendarx{

privateDatexcurrent;

publicCalendarx(intyear,intmonth,intday)

(

if(year<=0)

thrownewlllegalArgumentException("输入的年份有误!");

if(month<=0||month>12)

thrownewlllegalArgumentException("输入的月份有误!");

if(day<=0||day>Uitll.lastday(year,month))

thrownewlllegalArgumentException("输入的日期有误!");

current=newDatex(year,month,day);

}

publicDatexgetcurrent(){

returncurrent;

}

publicDatexgetPreviousDate(){

intyear=current.getYear();

intmonth=current.getMonth();

intday=current.getDay();

if(current.getDay()!=1)

returnnewDatex(year,month,day-1);

if(current.getMonth()==1)

returnnewDatex(year-1,12,Uitll.lastday(year-1,12));

returnnewDatex(year,month-1,Uitll.lastday(year,month-1));

}

publicDatexgetNextDate(){

intyear=current.getYear();

intmonth=current.getMonth();

intday=current.getDay();

if(Uitll.lastday(year,month)!=day)

returnnewDatex(year,month,day+1);

if(month==12){

returnnewDatex(year+1,1,1);

}

returnnewDatex(year,month+1,1);

}

//publicintlastday(intyear,intmonth)//使用数据表确定最后一天;

//{

//int[]m={0,31,28,31,30,31,30,31,31,30,31,30,31);

//if(year%4==0)

//m[2]=29;

//returnm[month];

//}

)

第三个包(含两个类)

packageevent;

publicclassEventDialogextendsjavax.swing.JDialog{

privateDatexcurrent;

privatelEventServiceeventservice;

privateJFrameparent;

publicEventDialog(JFrameparent,Datexcurrent,lEventService

eventservice){

super(parent,true);

initComponents();

setLocationRelativeTo(parent);

this.parent=parent;

this.eventservice=eventservice;

this.current=current;

init();

}

privatevoidinit(){

timeText.setText(current.toString());

try(

inti=0;

StringQstateStrings=newStringQ{"一般","较重要","很重要"};

Stringstatex=eventservice.getState(current);

stateText.setText(statex);

for(i=0;i<stateStrings.length;i++)

if(statex.equals(stateStrings[i]))

break;

stateComboBox.setSelectedlndex(i);

textArea.setText(eventService.readAII(current));

}catch(RuntimeExceptione){

stateText.setText("(无)");

stateitem.setEnabled(false);

}

}

privatevoidformWindowClosing(java.awt.event.WindowEventevt){

try(

Stringstate;

state=stateComboBox.getSelectedltem().toString();

Stringinfos=textArea.getText();

try(

if(eventservice.getState(current).equals(state)

&&eventservice.readAII(current).equals(infos)){

this.setVisible(false);

return;

}

}catch(Exceptione){

}

intresult=JOptionPane.showConfirmDialog(this,"今日日程已经改

变,是否保存?”,

"关闭信息框",JOptionPane.YES_NO_OPTION);

if(result==JOptionPane.YES_OPTION){

eventservice.saveAII(current,state,infos);

this.setVisible(false);

return;

}

}catch(RuntimeExceptione){

setVisible(false);

JOptionPane.showMessageDialog(parent,"建立"+

current.toString()

+"日程时出错,请重新建立!");

}

}

privatevoidstateComboBoxActionPerformed(java.awt.event.ActionEvent

evt){

Stringstate;

try(

state=stateComboBox.getSelectedltem().toString();

stateText.setText(state);

if(!stateltem.getText().equals。'(无)"))

stateitem.setEnabled(true);

}catch(RuntimeExceptione){

JOptionPane.showMessageDialog(parent,"设置日程状态出错!");

}

}

privatevoidstateltemActionPerformed(java.awt.event.ActionEventevt){

Stringstate;

try(

if(stateText.getText().equals。'(无)”))

stateitem.setEnabled(false);

state=eventservice.getState(current);

stateText.setText(state);

}catch(RuntimeExceptione){

}

}

privatevoidexitltemActionPerformed(java.awt.event.ActionEventevt){

setVisible(false);

}

privatevoidsaveltemActionPerformed(java.awt.event.ActionEventevt){

Stringstate;

try(

state=stateComboBox.getSelectedltem().toString();

Stringinfos=textArea.getText();

eventservice.saveAII(current,state,infos);

}catch(RuntimeExceptione){

setVisible(false);

JOptionPane.showMessageDialog(parent,"建立"+

current.toStringO

+"日程时出错,请重新建立!)

)

}

packageevent;

publicclassEventServiceimplementslEventService{

©Override

publicStringreadAII(Datexdate)throwsRuntimeException{

if(date==null)

thrownewRuntimeExcep寸on("日期不能为null!");

Stringresult=

try(

Fileinputstreamin=newFilelnputStream("schedules/"

+date.toString());

Scannerscanner=newScanner(in);

if(scanner.hasNextLine())

scanner.nextLine();

while(scanner.hasNextLine())

result+=scanner.nextLine();

in.close();

}catch(lOExceptione){

thrownewRuntimeException。从"+date.toString()+”磁盘读信息

时出错!)

)

returnresult;

}

©Override

publicvoidsaveAII(Datexdate,Stringstate,Stringinfo)

throwsRuntimeException{

if(date==null||state==null)

thrownewRuntimeException("日期和日程状态都不能为null!");

try(

FileWriterout=newFileWriter("schedules/"+date.toString());

out.write(state+"\n"+info);

out.close();

}catch(lOExceptione1){

thrownewRuntimeException("信息写入"+date.toString()+"磁盘

时出错!)

)

}

©Override

publicStringgetState(Datexdate)throwsRuntimeException{

if(date==null)

thrownewRuntimeException("日期不能为null!");

Stringresult=

try(

Fileinputstreamin=newFileInputStream("schedules/"

+date.toString());

Scannerscanner=newScanner(in);

if(scanner.hasNextLine())

result=scanner.nextLine();

in.close();

}catch(lOExceptione){

thrownewRuntimeException。从"+date.toString()+”磁盘读信息

时出错!)

}

returnresult;

}

)

packageevent;

importdateandweek.Datex;

publicinterfaceIEventService{

〃保存此日日程

voidsaveAII(Datexdate,Stringstate,Stringinfo)throwsRuntimeException;

//读取此日日程

StringreadAII(Datexdate)throwsRuntimeException;

〃获得此日日程状态

StringgetState(Datexdate)throwsRuntimeException;

}

第四个包(含五个类)

packagelogin;

publicclassfindPassWordDialogextendsjavax.swing.JDialog{

privateILoginServiceloginService;

privateStringname;

privateStringproblem;

privateStringanswer;

privateinterrorNumberl=0;

privateinterrorNumber2=0;

publicfindPassWordDialog(java.awt.Dialogparent,ILoginService

loginService){

super(parent,true);

initComponents();

setLocationRelativeTo(parent);

this.loginService=loginService;

}

privatevoidfindButtonActionPerformed(java.awt.event.ActionEventevt){

if(errorNumber1>0||errorNumber2>0)

(

JOptionPane.showMessageDialog(this,"填写的信息还有错,不能

查找!");

return;

}

StringpassWord="";

try(

passWord=loginService.findPassWord(name,problem,answer);

}catch(Exceptione){

JOptionPane.showMessageDialog(this,e.getMessage());

}

newPasswordText.setText(passWord);

this.setVisible(true);

}

privatevoidnameTextFocusLost(java.awt.event.FocusEventevt){

errorNumber1=0;

try(

name=nameText.getText().trim();

if(name.length()<3||name.length()>15){

nameOk.setText("x");

errorNumber1++;

}else{

nameOk.setText("V");

errorNumberl-;

}

}catch(Exceptione){

JOptionPane.showMessageDialog(this,"账户名不合法,此功能无法

运行!”);

)

}

privatevoidanswerTextFocusLost(java.awt.event.FocusEventevt){

errorNumber2=0;

try(

problem=problemComboBox.getSelectedltem().toString();

answer=answerText.getText().trim();

if(answer.length()<=0){

problemOK.setText("x");

errorNumber2++;

}else{

problemOK.setText("V");

errorNumber2-;

}

}catch(Exceptione){

JOptionPane.showMessageDialog(this,"问题选择有误,此功能无法

运行!”);

}

}

)

packagelogin;

importaccount.Account;

publicinterfaceILoginService{

〃获得账户

AccountloginAccount(StringnewName,StringnewPassWord)throws

RuntimeException;

〃获得Self账户

AccountgetAccount()throwsRuntimeException;

〃注册账户

voidregisterAccount(StringnewName,StringnewPassWord,String

problem,Stringanswer)throwsRuntimeException;

〃判断是否登录成功

booleanisOkOfLogin();

StringfindPassWord(Stringname,Stringproblem,Stringanswer)throws

RuntimeException;

〃判断记住密码是否已选择

booleanisChooseOfPassWord();

//设置记住密码,自动登录

voidset(StringrembPassWord);

}

packagelogin;

importjava.awt.Color;

importjavax.swing.JOptionPane;

importaccount.Account;

publicclassloginDialogextendsjavax.swing.JDialog{

privateILoginServiceloginService;

privatebooleanisRembPassWord=false;

publicloginDialog(java.awt.Frameparent,ILoginServiceloginService)

super(parent,true);

initComponents();

setLocationRelativeTo(parent);

this.loginService=loginService;

initLogin();

}

privatevoidinitLogin(){

try(

isRembPassWord=loginService.isChooseOfPassWord();

if(isRembPassWord)

passwordCheckBox.setSelected(true);

Accountaccount=loginService.getAccount();

if(isRembPassWord==false)

return;

accountText.setText(account.getName());

passwordField.setText(account.getPassWord());

}catch(Exceptione){

JOptionPane.showMessageDialog(this,"登录失败!");

}

}

privatevoidfindPasswordMouseExited(java.awt.event.MouseEventevt){

findPassword.setForeground(Color.BLACK);

}

privatevoidfindPasswordMouseEntered(java.awt.event.MouseEventevt)

(

findPassword.setForeground(Color.RED);

}

privatevoidgainAccountMouseExited(java.awt.event.MouseEventevt){

gainAccount.setForeground(Color.BLACK);

}

privatevoidgainAccountMouseEntered(java.awt.event.MouseEventevt){

gainAccount.setForeground(Color.RED);

}

privatevoid

passwordCheckBoxMouseClicked(java.awt.event.MouseEventevt){

StringrembPassWord="关";

if(passwordCheckBox.isSelected())

rembPassword="开";

try(

loginService.set(rembPassWord);

}catch(Exceptione){

JOptionPane.showMessageDialog(this,e.getMessage());

}

}

privatevoidfindPasswordMouseClicked(java.awt.event.MouseEventevt){

newfindPassWordDialog(this,loginService).setVisible(true);

}

privatevoidgainAccountMouseClicked(java.awt.event.MouseEventevt){

newRegisterAccountDialog(this,loginService).setVisible(true);

}

privatevoidloginButtonActionPerformed(java.awt.event.ActionEventevt){

try(

Stringname=accountText.getText();

if(name.equals("")){

JOptionPane.showMessageDialog(this,"账户不能空!");

return;

}

Stringpassword=String.valueOf(passwordField.getPassword());

if(password.equalsf"')){

JOptionPane.showMessageDialog(this,"密码不能空!");

return;

}

loginService.loginAccount(name,password);

this.setVisible(false);

}catch(Exceptione){

JOptionPane.showMessageDialog(this,e.getMessage());

}

}

)

packagelogin;

importjava.io.*;

importjava.util.Scanner;

importaccount.Account;

publicclassLoginServiceimplementsILoginService{

privateStringnewName;

privateStringnewPassWord;

©Override

publicAccountloginAccount(StringnewName,StringnewPassWord)

throwsRuntimeException{

this.newName=newName;

this.newPassWord=newPassWord;

returnjudgeAccount(newName,newPassWord);

}

privateString0readlnfo(StringfileName,intnum){

String[]result=newString[num];

try(

Fileinputstreamin=newFilelnputStream(fileName);

Scannerscanner=newScanner(in);

for(inti=0;i<num;i++)

if(scanner.hasNextLine())

result[i]=scanner.nextLine();

in.close();

}catch(lOExceptione){

thrownewRuntimeException("从"+fileName+”磁盘读信息时出

错!)

}

returnresult;

}

privatevoidwritelnfo(StringfileName,Stringinfo)

(

try(

FileWriterout=newFileWriter(fileName);

out.write(info);

out.close();

}catch(lOExceptione1){

thrownewRuntimeException("信息写入"+fileName+"磁盘时出

错!)

}

}

privateAccountjudgeAccount(StringnewName,StringnewPassWord){

String[]info;

if(newName==null||newPassWord==null)

thrownewRuntimeException("输入的账户和密码都不能为null");

try(

info=readlnfo("account",2);

}catch(Exceptione){

thrownewRuntimeException(e.getMessage());

}

if(!info[0].equals(newName))

thrownewRuntimeException("输入的账户名有误!");

if(!info[1].equals(newPassWord))

thrownewRuntimeException("输入的密码有误!");

returnnewAccount(info[0],info[1]);

}

©Override

publicvoidregisterAccount(StringnewName,StringnewPassWord,

Stringproblem,Stringanswer)throwsRuntimeException{

if(newName==null||problem==null||answer==null

||newPassWord==null)

thrownewRuntimeException("输入的账户,密码,问题和答案都不能

为null");

try(

writeInfo("account",newName+"\n"+newPassWord+"\n"+

problem+"\n"

+answer);

}catch(Exceptione){

thrownewRuntimeException(e.getMessage());

}

}

©Override

publicbooleanisOkOfl_ogin(){

try(

judgeAccount(newName,newPassWord);

}catch(Exceptione){

returnfalse;

}

returntrue;

}

©Override

publicStringfindPassWord(StringnewName,Stringproblem,String

answer)

throwsRuntimeException{

String[]info;

if(newName==null||problem==null||answer==null)

thrownewRuntimeException("输入的账户,问题和答案都不能为

null");

try(

info=readlnfo("account",4);

}catch(Exceptione){

thrownewRuntimeException(e.getMessage());

}

if(!info[0].equals(newName))

thrownewRuntimeException("输入的账户名有误!");

if(!info[2].equals(problem))

thrownewRuntimeException("选择的问题有误!");

if(!info[3].equals(answer))

thrownewRuntimeException("问题的答案有误!");

returninfo[1];

}

©Override

publicbooleanisChooseOfPassWord(){

String[]info;

try(

info=readlnfo("set",1);

}catch(Exceptione){

thrownewRuntimeException(e.getMessage());

}

if(info[0].equals("JF"))

returntrue;

returnfalse;

}

©Override

publicvoidset(StringrembPassWord){

if(rembPassWord==null)

thrownewRuntimeException("输入的记住密码设置和自动登录设

置都不能为null");

try(

writelnfo("set",rembPassWord+"\n");

}catch(Exceptione){

thrownewRuntimeException(e.getMessage());

}

}

©Override

publicAccountgetAccount()throwsRuntimeException{

String[]info;

try(

info=readlnfo("account",2);

}catch(Exceptione){

thrownewRuntimeException(e.getMessage());

}

returnnewAccount(info[0],info[1]);

}

)

/*

*RegisterAccountDialog.java

*

*Createdon_DATE_,_TIME_

*/

packagelogin;

importjava.awt.Font;

importjavax.swing.JOptionPane;

publicclassRegisterAccountDialogextendsjavax.swing.JDialog{

privateStringname;

privateStringpassword;

privateStringanswer;

privateStringproblem;

privateILoginServiceloginService;

privateinterrorNumber1=0;

privateinterrorNumber3=0;

privateinterrorNumber2=0;

privateinterrorNumber4=0;

]

publicRegisterAccountDialog(java.awt.Dialogparent,

ILoginServiceloginService){

super(parent,true);

initComponents();

setLocationRelativeTo(parent);

this.loginService=loginService;

}

privatevoidregisterButtonActionPerformed(java.awt.event.ActionEvent

evt){

try(

if(name==null||password==null||answer==null){

JOptionPane.showMessageDialog(this,"还有未填写的空,不能

注册!");

return;

}

if(errorNumber1>0||errorNumber2>0||errorNumber3>0||errorNumber4>0)

(

JOptionPane.showMessageDialog(this,"填写的信息还有错,不

能注册!)

return;

}

loginService.registerAccount(name,password,problem,answer);

this.setVisible(false);

}catch(Exceptione){

JOptionPane.showMessageDialog(this,"对不起!注册失败,请稍后

注册。");

}

}

privatevoidformWindowClosing(java.awt.event.WindowEventevt){

intresult=JOptionPane.showConfirmDialog(this,"是否放弃此次注

册?","关闭信息框",

JOptionPane.YES_NO_OPTION);

if(result==JOptionPane.NO_OPTION)

(

this.setVisible(false);

}

this.setVisible(true);

}

privatevoidnameTextFocusLost(java.awt.event.FocusEventevt){

errorNumber1=0;

try(

name=nameText.getText().trim();

if(name.length()<3||name.length()>15)

(

nameOk.setText("x");

errorNumber1++;

}else{

nameOk.setText("V");

errorNumberl-;

}

}catch(Exceptione){

JOptionPane.showMessageDialog(this,"账户名不合法,此功能无法

运行!");

}

}

privatevoidanswerTextFocusLost(java.awt.event.FocusEventevt){

errorNumber2=0;

try(

problem=problemComboBox.getSelectedltem().toString();

answer=answerText.getText().trim();

if(answer.Iength()<=0)

(

answerOK.setText("x");

errorNumber2++;

}else{

answerOK.setText("J");

errorNumber2-;

}

}catch(Exceptione){

}

}

privatevoidisPasswordFieldFocusLost(java.awt.event.FocusEventevt){

errorNumber3=0;

try(

StringispassWord=

String.valueOf(isPasswordField.getPassword())

.trim();

System.out.println("ispassWord="+ispassWord);

System.out.println(passWord);

if(password.equals(ispassWord))

(

isPassWordOk.setText("V");

errorNumber3-;

}else{

isPassWordOk.setText("x");

errorNumber3++;

}

}catch(Exceptione){

JOptionPane.showMessageDialog(this,"问题的答案不合法,此功能

无法运行!)

}

}

privatevoidpasswordFieldFocusLost(java.awt.event.FocusEventevt){

errorNumber4=0;

try(

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论