├── out
└── production
│ └── Java大作业
│ ├── META-INF
│ └── Java大作业.kotlin_module
│ ├── Dao
│ ├── BaseDao.class
│ ├── EleInfoDao.class
│ ├── UserInfoDao.class
│ ├── EleRunInfoDao.class
│ └── UserLoginInfoDao.class
│ ├── GUI
│ ├── MyTabel.class
│ ├── AppMainWindow.class
│ ├── MyIconButton.class
│ ├── AppMainWindow$1.class
│ └── Panel
│ │ ├── EleInfoPanel.class
│ │ ├── ToolBarPanel.class
│ │ ├── EleInfoPanel$1.class
│ │ ├── EleInfoPanel$2.class
│ │ ├── EleInfoPanel$3.class
│ │ ├── EleInfoPanel$4.class
│ │ ├── EleInfoPanel$5.class
│ │ ├── EleRunInfoPanel.class
│ │ ├── UserInfoPanel$1.class
│ │ ├── UserInfoPanel$2.class
│ │ ├── UserInfoPanel$3.class
│ │ ├── UserInfoPanel$4.class
│ │ ├── UserInfoPanel$5.class
│ │ ├── UserInfoPanel.class
│ │ ├── UserLoginPanel.class
│ │ ├── EleRunInfoPanel$1.class
│ │ ├── EleRunInfoPanel$2.class
│ │ ├── EleRunInfoPanel$3.class
│ │ ├── EleInfoPanelPackage
│ │ ├── SettingPanelAddone.class
│ │ ├── SettingPanelShowById.class
│ │ ├── SettingPanelShowall.class
│ │ ├── SettingPanelDeleteone.class
│ │ ├── SettingPanelShowById$1.class
│ │ ├── SettingPanelUpdateone.class
│ │ ├── SettingPanelDeleteone$1.class
│ │ └── SettingPanelUpdateone$1.class
│ │ ├── UserInfoPanelPackage
│ │ ├── SettingPanelAddone.class
│ │ ├── SettingPanelShowall.class
│ │ ├── SettingPanelDeleteone.class
│ │ ├── SettingPanelShowById.class
│ │ ├── SettingPanelUpdateone.class
│ │ ├── SettingPanelDeleteone$1.class
│ │ └── SettingPanelShowById$1.class
│ │ └── EleRunInfoPanelPackage
│ │ ├── SettingPanelShowall.class
│ │ ├── SettingpanelShowErrmsg.class
│ │ ├── SettingPanelRunningTime.class
│ │ └── SettingPanelRunningTime$1.class
│ ├── System
│ ├── Main.class
│ ├── InputCheck.class
│ ├── MainSystem.class
│ ├── EleInfoSystem.class
│ ├── LoginSystem.class
│ ├── UserInfoSystem.class
│ └── EleRunInfoSystem.class
│ ├── tables
│ ├── EleInfo.class
│ ├── UserInfo.class
│ ├── EleRunInfo.class
│ └── UserLoginInfo.class
│ ├── resources
│ └── icon
│ │ ├── now.png
│ │ ├── clear.png
│ │ ├── confirm.png
│ │ ├── eleinfo.png
│ │ ├── login.png
│ │ ├── loginb.png
│ │ ├── model.psd
│ │ ├── settime.png
│ │ ├── start.png
│ │ ├── status.png
│ │ ├── findbyid.png
│ │ ├── nowEnable.png
│ │ ├── userinfo.png
│ │ ├── clearDisable.png
│ │ ├── clearEnable.png
│ │ ├── eleruninfo.png
│ │ ├── findbyboth.png
│ │ ├── findbyrange.png
│ │ ├── loginEnable.png
│ │ ├── loginbEnable.png
│ │ ├── nowDisable.png
│ │ ├── startDisable.png
│ │ ├── startEnable.png
│ │ ├── statusEnable.png
│ │ ├── updateadmin.png
│ │ ├── confirmDisable.png
│ │ ├── confirmEnable.png
│ │ ├── eleinfoEnable.png
│ │ ├── findbyidEnable.png
│ │ ├── loginbDisable.png
│ │ ├── rangeandonline.png
│ │ ├── settimeDisable.png
│ │ ├── settimeEnable.png
│ │ ├── testLinkButton.png
│ │ ├── updatepassword.png
│ │ ├── userinfoEnable.png
│ │ ├── eleruninfoEnable.png
│ │ ├── findbybothDisable.png
│ │ ├── findbybothEnable.png
│ │ ├── findbyidDisable.png
│ │ ├── findbyrangeEnable.png
│ │ ├── updateadminEnable.png
│ │ ├── findbyrangeDisable.png
│ │ ├── updateadminDisable.png
│ │ ├── rangeandonlineDisable.png
│ │ ├── rangeandonlineEnable.png
│ │ ├── testLinkButtonDisable.png
│ │ ├── testLinkButtonEnable.png
│ │ ├── updatepasswordDisable.png
│ │ └── updatepasswordEnable.png
│ └── view
│ ├── EleInfoView.class
│ ├── UserInfoView.class
│ └── EleRunInfoView.class
├── 电梯维护管理系统项目设计书.docx
├── lib
├── Access_JDBC40.jar
├── sqljdbc4_2008_jre6.jar
└── mysql-connector-java-5.1.37-bin.jar
├── src
├── resources
│ └── icon
│ │ ├── now.png
│ │ ├── clear.png
│ │ ├── login.png
│ │ ├── loginb.png
│ │ ├── model.psd
│ │ ├── start.png
│ │ ├── status.png
│ │ ├── confirm.png
│ │ ├── eleinfo.png
│ │ ├── findbyid.png
│ │ ├── settime.png
│ │ ├── userinfo.png
│ │ ├── clearEnable.png
│ │ ├── eleruninfo.png
│ │ ├── findbyboth.png
│ │ ├── findbyrange.png
│ │ ├── loginEnable.png
│ │ ├── nowDisable.png
│ │ ├── nowEnable.png
│ │ ├── startEnable.png
│ │ ├── updateadmin.png
│ │ ├── clearDisable.png
│ │ ├── confirmEnable.png
│ │ ├── eleinfoEnable.png
│ │ ├── loginbDisable.png
│ │ ├── loginbEnable.png
│ │ ├── settimeEnable.png
│ │ ├── startDisable.png
│ │ ├── statusEnable.png
│ │ ├── confirmDisable.png
│ │ ├── eleruninfoEnable.png
│ │ ├── findbybothEnable.png
│ │ ├── findbyidDisable.png
│ │ ├── findbyidEnable.png
│ │ ├── rangeandonline.png
│ │ ├── settimeDisable.png
│ │ ├── testLinkButton.png
│ │ ├── updatepassword.png
│ │ ├── userinfoEnable.png
│ │ ├── findbybothDisable.png
│ │ ├── findbyrangeDisable.png
│ │ ├── findbyrangeEnable.png
│ │ ├── updateadminDisable.png
│ │ ├── updateadminEnable.png
│ │ ├── rangeandonlineDisable.png
│ │ ├── rangeandonlineEnable.png
│ │ ├── testLinkButtonDisable.png
│ │ ├── testLinkButtonEnable.png
│ │ ├── updatepasswordDisable.png
│ │ └── updatepasswordEnable.png
├── System
│ ├── Main.java
│ ├── LoginSystem.java
│ ├── InputCheck.java
│ ├── EleRunInfoSystem.java
│ ├── MainSystem.java
│ ├── EleInfoSystem.java
│ └── UserInfoSystem.java
├── tables
│ ├── UserLoginInfo.java
│ ├── EleRunInfo.java
│ ├── UserInfo.java
│ └── EleInfo.java
├── Dao
│ ├── UserLoginInfoDao.java
│ ├── BaseDao.java
│ ├── EleRunInfoDao.java
│ ├── EleInfoDao.java
│ └── UserInfoDao.java
├── GUI
│ ├── MyIconButton.java
│ ├── Panel
│ │ ├── UserInfoPanelPackage
│ │ │ ├── SettingPanelShowall.java
│ │ │ ├── SettingPanelDeleteone.java
│ │ │ ├── SettingPanelUpdateone.java
│ │ │ ├── SettingPanelAddone.java
│ │ │ └── SettingPanelShowById.java
│ │ ├── EleRunInfoPanelPackage
│ │ │ ├── SettingPanelShowall.java
│ │ │ ├── SettingpanelShowErrmsg.java
│ │ │ └── SettingPanelRunningTime.java
│ │ ├── EleInfoPanelPackage
│ │ │ ├── SettingPanelShowall.java
│ │ │ ├── SettingPanelDeleteone.java
│ │ │ ├── SettingPanelUpdateone.java
│ │ │ ├── SettingPanelAddone.java
│ │ │ └── SettingPanelShowById.java
│ │ ├── ToolBarPanel.java
│ │ ├── UserLoginPanel.java
│ │ ├── EleRunInfoPanel.java
│ │ └── EleInfoPanel.java
│ ├── MyTabel.java
│ └── AppMainWindow.java
└── view
│ ├── EleRunInfoView.java
│ ├── EleInfoView.java
│ └── UserInfoView.java
├── .idea
├── vcs.xml
├── modules.xml
├── encodings.xml
├── misc.xml
├── inspectionProfiles
│ └── Project_Default.xml
└── uiDesigner.xml
└── Java大作业.iml
/out/production/Java大作业/META-INF/Java大作业.kotlin_module:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/电梯维护管理系统项目设计书.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/电梯维护管理系统项目设计书.docx
--------------------------------------------------------------------------------
/lib/Access_JDBC40.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/lib/Access_JDBC40.jar
--------------------------------------------------------------------------------
/lib/sqljdbc4_2008_jre6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/lib/sqljdbc4_2008_jre6.jar
--------------------------------------------------------------------------------
/src/resources/icon/now.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/now.png
--------------------------------------------------------------------------------
/src/resources/icon/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/clear.png
--------------------------------------------------------------------------------
/src/resources/icon/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/login.png
--------------------------------------------------------------------------------
/src/resources/icon/loginb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/loginb.png
--------------------------------------------------------------------------------
/src/resources/icon/model.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/model.psd
--------------------------------------------------------------------------------
/src/resources/icon/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/start.png
--------------------------------------------------------------------------------
/src/resources/icon/status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/status.png
--------------------------------------------------------------------------------
/src/resources/icon/confirm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/confirm.png
--------------------------------------------------------------------------------
/src/resources/icon/eleinfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/eleinfo.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyid.png
--------------------------------------------------------------------------------
/src/resources/icon/settime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/settime.png
--------------------------------------------------------------------------------
/src/resources/icon/userinfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/userinfo.png
--------------------------------------------------------------------------------
/src/resources/icon/clearEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/clearEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/eleruninfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/eleruninfo.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyboth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyboth.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyrange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyrange.png
--------------------------------------------------------------------------------
/src/resources/icon/loginEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/loginEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/nowDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/nowDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/nowEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/nowEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/startEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/startEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/updateadmin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/updateadmin.png
--------------------------------------------------------------------------------
/src/resources/icon/clearDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/clearDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/confirmEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/confirmEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/eleinfoEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/eleinfoEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/loginbDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/loginbDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/loginbEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/loginbEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/settimeEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/settimeEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/startDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/startDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/statusEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/statusEnable.png
--------------------------------------------------------------------------------
/lib/mysql-connector-java-5.1.37-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/lib/mysql-connector-java-5.1.37-bin.jar
--------------------------------------------------------------------------------
/src/resources/icon/confirmDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/confirmDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/eleruninfoEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/eleruninfoEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/findbybothEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbybothEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyidDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyidDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyidEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyidEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/rangeandonline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/rangeandonline.png
--------------------------------------------------------------------------------
/src/resources/icon/settimeDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/settimeDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/testLinkButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/testLinkButton.png
--------------------------------------------------------------------------------
/src/resources/icon/updatepassword.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/updatepassword.png
--------------------------------------------------------------------------------
/src/resources/icon/userinfoEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/userinfoEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/Dao/BaseDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/Dao/BaseDao.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/MyTabel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/MyTabel.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/Main.class
--------------------------------------------------------------------------------
/src/resources/icon/findbybothDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbybothDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyrangeDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyrangeDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/findbyrangeEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/findbyrangeEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/updateadminDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/updateadminDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/updateadminEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/updateadminEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/Dao/EleInfoDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/Dao/EleInfoDao.class
--------------------------------------------------------------------------------
/out/production/Java大作业/Dao/UserInfoDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/Dao/UserInfoDao.class
--------------------------------------------------------------------------------
/out/production/Java大作业/tables/EleInfo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/tables/EleInfo.class
--------------------------------------------------------------------------------
/out/production/Java大作业/tables/UserInfo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/tables/UserInfo.class
--------------------------------------------------------------------------------
/src/resources/icon/rangeandonlineDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/rangeandonlineDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/rangeandonlineEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/rangeandonlineEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/testLinkButtonDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/testLinkButtonDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/testLinkButtonEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/testLinkButtonEnable.png
--------------------------------------------------------------------------------
/src/resources/icon/updatepasswordDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/updatepasswordDisable.png
--------------------------------------------------------------------------------
/src/resources/icon/updatepasswordEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/src/resources/icon/updatepasswordEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/Dao/EleRunInfoDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/Dao/EleRunInfoDao.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/AppMainWindow.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/AppMainWindow.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/MyIconButton.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/MyIconButton.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/InputCheck.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/InputCheck.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/MainSystem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/MainSystem.class
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/now.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/now.png
--------------------------------------------------------------------------------
/out/production/Java大作业/tables/EleRunInfo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/tables/EleRunInfo.class
--------------------------------------------------------------------------------
/out/production/Java大作业/view/EleInfoView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/view/EleInfoView.class
--------------------------------------------------------------------------------
/out/production/Java大作业/view/UserInfoView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/view/UserInfoView.class
--------------------------------------------------------------------------------
/out/production/Java大作业/Dao/UserLoginInfoDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/Dao/UserLoginInfoDao.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/AppMainWindow$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/AppMainWindow$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/EleInfoSystem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/EleInfoSystem.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/LoginSystem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/LoginSystem.class
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/clear.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/confirm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/confirm.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/eleinfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/eleinfo.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/login.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/loginb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/loginb.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/model.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/model.psd
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/settime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/settime.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/start.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/status.png
--------------------------------------------------------------------------------
/out/production/Java大作业/tables/UserLoginInfo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/tables/UserLoginInfo.class
--------------------------------------------------------------------------------
/out/production/Java大作业/view/EleRunInfoView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/view/EleRunInfoView.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanel.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/ToolBarPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/ToolBarPanel.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/UserInfoSystem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/UserInfoSystem.class
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyid.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/nowEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/nowEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/userinfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/userinfo.png
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanel$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanel$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanel$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanel$2.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanel$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanel$3.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanel$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanel$4.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanel$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanel$5.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanel.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanel$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanel$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanel$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanel$2.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanel$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanel$3.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanel$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanel$4.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanel$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanel$5.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanel.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserLoginPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserLoginPanel.class
--------------------------------------------------------------------------------
/out/production/Java大作业/System/EleRunInfoSystem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/System/EleRunInfoSystem.class
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/clearDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/clearDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/clearEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/clearEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/eleruninfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/eleruninfo.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyboth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyboth.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyrange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyrange.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/loginEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/loginEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/loginbEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/loginbEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/nowDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/nowDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/startDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/startDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/startEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/startEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/statusEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/statusEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/updateadmin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/updateadmin.png
--------------------------------------------------------------------------------
/src/System/Main.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | public class Main {
4 | public static void main(String args[]) {
5 | MainSystem.choose();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanel$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanel$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanel$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanel$2.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanel$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanel$3.class
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/confirmDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/confirmDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/confirmEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/confirmEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/eleinfoEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/eleinfoEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyidEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyidEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/loginbDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/loginbDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/rangeandonline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/rangeandonline.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/settimeDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/settimeDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/settimeEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/settimeEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/testLinkButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/testLinkButton.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/updatepassword.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/updatepassword.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/userinfoEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/userinfoEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/eleruninfoEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/eleruninfoEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbybothDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbybothDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbybothEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbybothEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyidDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyidDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyrangeEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyrangeEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/updateadminEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/updateadminEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/findbyrangeDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/findbyrangeDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/updateadminDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/updateadminDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/rangeandonlineDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/rangeandonlineDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/rangeandonlineEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/rangeandonlineEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/testLinkButtonDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/testLinkButtonDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/testLinkButtonEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/testLinkButtonEnable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/updatepasswordDisable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/updatepasswordDisable.png
--------------------------------------------------------------------------------
/out/production/Java大作业/resources/icon/updatepasswordEnable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/resources/icon/updatepasswordEnable.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelAddone.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelAddone.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelShowById.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelShowById.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelShowall.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelShowall.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelAddone.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelAddone.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelShowall.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelShowall.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelDeleteone.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelDeleteone.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelShowById$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelShowById$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelUpdateone.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelUpdateone.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingPanelShowall.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingPanelShowall.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelDeleteone.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelDeleteone.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelShowById.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelShowById.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelUpdateone.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelUpdateone.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelDeleteone$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelDeleteone$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelUpdateone$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleInfoPanelPackage/SettingPanelUpdateone$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingpanelShowErrmsg.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingpanelShowErrmsg.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelDeleteone$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelDeleteone$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelShowById$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/UserInfoPanelPackage/SettingPanelShowById$1.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingPanelRunningTime.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingPanelRunningTime.class
--------------------------------------------------------------------------------
/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingPanelRunningTime$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WhyRoy/Java-GUI-Practice/HEAD/out/production/Java大作业/GUI/Panel/EleRunInfoPanelPackage/SettingPanelRunningTime$1.class
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/System/LoginSystem.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | import Dao.UserLoginInfoDao;
4 |
5 | import java.util.Scanner;
6 |
7 | public class LoginSystem {
8 | public static boolean Login() {
9 | Scanner cin = new Scanner(System.in);
10 | System.out.print("请输入你的id:");
11 | String userid = cin.next();
12 | String pwd = UserLoginInfoDao.findpwdbyid(userid);
13 | System.out.print("请输入你的密码:");
14 | String input = cin.next();
15 | return input.equals(pwd);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/tables/UserLoginInfo.java:
--------------------------------------------------------------------------------
1 | package tables;
2 |
3 | public class UserLoginInfo {
4 | private String userid;
5 | private String userpwd;
6 | private boolean useradmin;
7 |
8 | public String getUserid() {
9 | return userid;
10 | }
11 |
12 | public void setUserid(String userid) {
13 | this.userid = userid;
14 | }
15 |
16 | public String getUserpwd() {
17 | return userpwd;
18 | }
19 |
20 | public void setUserpwd(String userpwd) {
21 | this.userpwd = userpwd;
22 | }
23 |
24 | public boolean isUseradmin() {
25 | return useradmin;
26 | }
27 |
28 | public void setUseradmin(boolean useradmin) {
29 | this.useradmin = useradmin;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/System/InputCheck.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | import java.text.ParseException;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 | import java.util.regex.Pattern;
7 |
8 | public class InputCheck {
9 | public static boolean datecheck(String date) {
10 | String s = date;
11 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
12 | try {
13 | Date d = sdf.parse(s);
14 | return true;
15 | } catch (ParseException e) {
16 | return false;
17 | }
18 | }
19 |
20 | public static boolean pwdcheck(String pwd) {
21 | if (pwd.length() != 6) return false;
22 | Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
23 | if (!pattern.matcher(pwd).matches()) return false;
24 | return true;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/tables/EleRunInfo.java:
--------------------------------------------------------------------------------
1 | package tables;
2 |
3 | public class EleRunInfo {
4 | private String eleid;
5 | private boolean eleisrunning;
6 | private int elerunningtime;
7 | private String eleerrormsg;
8 |
9 | public String getEleid() {
10 | return eleid;
11 | }
12 |
13 | public void setEleid(String eleid) {
14 | this.eleid = eleid;
15 | }
16 |
17 | public boolean isEleisrunning() {
18 | return eleisrunning;
19 | }
20 |
21 | public void setEleisrunning(boolean eleisrunning) {
22 | this.eleisrunning = eleisrunning;
23 | }
24 |
25 | public int getElerunningtime() {
26 | return elerunningtime;
27 | }
28 |
29 | public void setElerunningtime(int elerunningtime) {
30 | this.elerunningtime = elerunningtime;
31 | }
32 |
33 | public String getEleerrormsg() {
34 | return eleerrormsg;
35 | }
36 |
37 | public void setEleerrormsg(String eleerrormsg) {
38 | this.eleerrormsg = eleerrormsg;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/tables/UserInfo.java:
--------------------------------------------------------------------------------
1 | package tables;
2 |
3 | public class UserInfo {
4 | private String userid;
5 | private String username;
6 | private boolean useradmin;
7 | private String userrange;
8 | private boolean useronline;
9 |
10 | public String getUserid() {
11 | return userid;
12 | }
13 |
14 | public void setUserid(String userid) {
15 | this.userid = userid;
16 | }
17 |
18 | public String getUsername() {
19 | return username;
20 | }
21 |
22 | public void setUsername(String username) {
23 | this.username = username;
24 | }
25 |
26 | public boolean isUseradmin() {
27 | return useradmin;
28 | }
29 |
30 | public void setUseradmin(boolean useradmin) {
31 | this.useradmin = useradmin;
32 | }
33 |
34 | public String getUserrange() {
35 | return userrange;
36 | }
37 |
38 | public void setUserrange(String userrange) {
39 | this.userrange = userrange;
40 | }
41 |
42 | public boolean isUseronline() {
43 | return useronline;
44 | }
45 |
46 | public void setUseronline(boolean useronline) {
47 | this.useronline = useronline;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/Dao/UserLoginInfoDao.java:
--------------------------------------------------------------------------------
1 | package Dao;
2 |
3 |
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 |
7 | public class UserLoginInfoDao {
8 | //根据userid查询password
9 | public static String findpwdbyid(String userid) {
10 | try {
11 | String pwd = "";
12 | String sql = "SELECT userpwd FROM UserLoginInfo WHERE userid = '" + userid + "'";
13 | System.out.println("执行: " + sql);
14 | ResultSet rs = BaseDao.executeQuery(sql);
15 | if (rs.next()) {
16 | pwd = rs.getString("userpwd");
17 | }
18 | rs.close();
19 | BaseDao.dbClose();
20 | return pwd;
21 | } catch (SQLException e) {
22 | e.printStackTrace();
23 | return null;
24 | }
25 | }
26 |
27 | //更改密码
28 | public static void updatepassword(String pwd, String id) {
29 | String sql = "update UserLoginInfo set userpwd = '" + pwd + "' WHERE userid = '" + id + "'";
30 | System.out.println("执行: " + sql);
31 | int r = BaseDao.executeUpdate(sql);
32 | if (r > 0) {
33 | System.out.println("成功更新" + r + "个用户密码");
34 | }
35 | BaseDao.dbClose();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Java大作业.iml:
--------------------------------------------------------------------------------
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 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/tables/EleInfo.java:
--------------------------------------------------------------------------------
1 | package tables;
2 |
3 | import java.sql.Date;
4 |
5 | public class EleInfo {
6 | private String eleid;
7 | private String eletype;
8 | private Date elecreatedate;
9 | private String elerange;
10 | private String eleaddress;
11 | private Date elelastmtdate;
12 |
13 | public String getEleid() {
14 | return eleid;
15 | }
16 |
17 | public void setEleid(String eleid) {
18 | this.eleid = eleid;
19 | }
20 |
21 | public String getEletype() {
22 | return eletype;
23 | }
24 |
25 | public void setEletype(String eletype) {
26 | this.eletype = eletype;
27 | }
28 |
29 | public Date getElecreatedate() {
30 | return elecreatedate;
31 | }
32 |
33 | public void setElecreatedate(Date elecreatedate) {
34 | this.elecreatedate = elecreatedate;
35 | }
36 |
37 | public String getElerange() {
38 | return elerange;
39 | }
40 |
41 | public void setElerange(String elerange) {
42 | this.elerange = elerange;
43 | }
44 |
45 | public String getEleaddress() {
46 | return eleaddress;
47 | }
48 |
49 | public void setEleaddress(String eleaddress) {
50 | this.eleaddress = eleaddress;
51 | }
52 |
53 | public Date getElelastmtdate() {
54 | return elelastmtdate;
55 | }
56 |
57 | public void setElelastmtdate(Date elelastmtdate) {
58 | this.elelastmtdate = elelastmtdate;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/System/EleRunInfoSystem.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | import view.EleRunInfoView;
4 |
5 | import java.util.Scanner;
6 |
7 | public class EleRunInfoSystem {
8 | public static void showmenu() {
9 | System.out.println("1.显示所有电梯运行状况");
10 | System.out.println("2.查询出错的电梯信息");
11 | System.out.println("3.查询电梯运行时间");
12 | System.out.println("");
13 | System.out.println("0.返回上一级");
14 | }
15 |
16 | public static void showall() {
17 | EleRunInfoView.showallEleRunInfo();
18 | }
19 |
20 | public static void showerrormsg() {
21 | EleRunInfoView.showstopEleInfo();
22 | }
23 |
24 | public static void runningtime() {
25 | Scanner cin = new Scanner(System.in);
26 | System.out.print("输入阈值(hours): ");
27 | int time = cin.nextInt();
28 | EleRunInfoView.showruntimegreater(time);
29 | }
30 |
31 | public static void choose() {
32 | Scanner cin = new Scanner(System.in);
33 | byte n = 0;
34 | showmenu();
35 | n = cin.nextByte();
36 | while (n != 0) {
37 | switch (n) {
38 | case 1:
39 | showall();
40 | break;
41 | case 2:
42 | showerrormsg();
43 | break;
44 | case 3:
45 | runningtime();
46 | break;
47 | }
48 | showmenu();
49 | n = cin.nextByte();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/GUI/MyIconButton.java:
--------------------------------------------------------------------------------
1 | package GUI;
2 |
3 | import javax.swing.*;
4 | import java.awt.*;
5 |
6 | /**
7 | * 自定义按钮类,支持自定义默认图标、激活图标、失效图标和tip提示
8 | *
9 | */
10 | public class MyIconButton extends JButton {
11 |
12 | private static final long serialVersionUID = 1L;
13 | private ImageIcon iconEnable, iconDisable;
14 | private String tip;
15 |
16 | /**
17 | * 构造
18 | *
19 | * @param iconNormal 默认图标
20 | * @param iconEnable 激活图标
21 | * @param iconDisable 失效图标
22 | * @param tip 提示
23 | */
24 | public MyIconButton(ImageIcon iconNormal, ImageIcon iconEnable, ImageIcon iconDisable, String tip) {
25 | super(iconNormal);
26 |
27 | this.iconEnable = iconEnable;
28 | this.iconDisable = iconDisable;
29 | this.tip = tip;
30 |
31 | initialize();
32 | setUp();
33 | }
34 |
35 | /**
36 | * 初始化,设置按钮属性:无边,无焦点渲染,无内容区,各边距0
37 | */
38 | private void initialize() {
39 | this.setBorderPainted(false);
40 | this.setFocusPainted(false);
41 | this.setContentAreaFilled(false);
42 | this.setFocusable(true);
43 | this.setMargin(new Insets(0, 0, 0, 0));
44 | }
45 |
46 | /**
47 | * 设置按钮图标:鼠标移过、按压、失效的图标 和设置按钮提示
48 | */
49 | private void setUp() {
50 | this.setRolloverIcon(iconEnable);
51 | // this.setSelectedIcon(iconEnable);
52 | this.setPressedIcon(iconEnable);
53 | this.setDisabledIcon(iconDisable);
54 |
55 | if (!tip.equals("")) {
56 | this.setToolTipText(tip);
57 | }
58 |
59 | }
60 | }
--------------------------------------------------------------------------------
/src/view/EleRunInfoView.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import Dao.EleRunInfoDao;
4 | import tables.EleRunInfo;
5 |
6 | import java.util.List;
7 |
8 | public class EleRunInfoView {
9 | //输出单条记录
10 | public static void showOneEleInfo(EleRunInfo s) {
11 | System.out.print("\t" + s.getEleid());
12 | if (s.isEleisrunning()) {
13 | System.out.print("\t正在运行");
14 | } else {
15 | System.out.print("\t停止运行");
16 | }
17 | System.out.print("\t" + s.getElerunningtime() + "Hours");
18 | if (s.getEleerrormsg() != null) {
19 | System.out.print("\t" + s.getEleerrormsg());
20 | }
21 | System.out.print("\n");
22 | }
23 |
24 | public static void showallEleRunInfo() {
25 | int n = 0;
26 | List list = EleRunInfoDao.allEleRunInfo();
27 | for (EleRunInfo s : list) {
28 | n++;
29 | showOneEleInfo(s);
30 | }
31 | }
32 |
33 | public static void showstopEleInfo() {
34 | int n = 0;
35 | List list = EleRunInfoDao.stopEleInfomsg();
36 | for (EleRunInfo s : list) {
37 | n++;
38 | showOneEleInfo(s);
39 | }
40 | }
41 |
42 | public static void showruntimegreater(int time) {
43 | int n = 0;
44 | List list = EleRunInfoDao.findruntimegreater(time);
45 | for (EleRunInfo s : list) {
46 | n++;
47 | showOneEleInfo(s);
48 | }
49 | }
50 |
51 | public static int showcounterror() {
52 | return EleRunInfoDao.counterror();
53 | }
54 |
55 | public static int showcountall() {
56 | return EleRunInfoDao.countall();
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/view/EleInfoView.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import Dao.EleInfoDao;
4 | import tables.EleInfo;
5 |
6 | import java.util.List;
7 |
8 | public class EleInfoView {
9 | //输出topbar
10 | public static void topbar() {
11 | System.out.print("\t电梯ID");
12 | System.out.print("\t电梯型号");
13 | System.out.print("\t创建日期");
14 | System.out.print("\t所在区域");
15 | System.out.print("\t所在地址");
16 | System.out.print("\t最近检修日期");
17 | System.out.print("\n");
18 | }
19 |
20 | //输出单条记录
21 | public static void showOneEleInfo(EleInfo s) {
22 | System.out.print("\t" + s.getEleid());
23 | System.out.print("\t" + s.getEletype());
24 | System.out.print("\t" + s.getElecreatedate());
25 | System.out.print("\t" + s.getElerange());
26 | System.out.print("\t" + s.getEleaddress());
27 | System.out.print("\t" + s.getElelastmtdate());
28 | System.out.print("\n");
29 | }
30 |
31 | //输出所有记录
32 | public static void allEleInfo() {
33 | int n = 0;
34 | List list = EleInfoDao.allEleInfo();
35 | topbar();
36 | for (EleInfo s : list) {
37 | n++;
38 | showOneEleInfo(s);
39 | }
40 | }
41 |
42 | //输出指定eleid的第一条记录
43 | public static void oneEleInfo(String eleid) {
44 | EleInfo s;
45 | s = EleInfoDao.findbyeleid(eleid);
46 | if (s != null) {
47 | showOneEleInfo(s);
48 | }
49 | }
50 |
51 | //输出指定elerange的第一条记录
52 | public static void allElerange(String elerange) {
53 | int n = 0;
54 | List list = EleInfoDao.findbyelerange(elerange);
55 | for (EleInfo s : list) {
56 | n++;
57 | showOneEleInfo(s);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/System/MainSystem.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | import Dao.EleRunInfoDao;
4 | import view.EleRunInfoView;
5 |
6 | import java.util.Scanner;
7 |
8 | public class MainSystem {
9 | public static void showmenu() {
10 | System.out.println("1.电梯信息");
11 | System.out.println("2.用户信息");
12 | System.out.println("3.电梯运行情况");
13 | System.out.println("");
14 | System.out.println("0.退出");
15 | }
16 |
17 | public static void choose() {
18 | Scanner cin = new Scanner(System.in);
19 |
20 | if (!LoginSystem.Login()) {
21 | System.out.println("密码错误");
22 | return;
23 | }
24 |
25 | System.out.println("正在初始化系统......");
26 | EleRunInfoDao.initruntime();
27 | int all = EleRunInfoView.showcountall();
28 | int err = EleRunInfoView.showcounterror();
29 | int normal = all - err;
30 | System.out.println("初始化完成!");
31 | try {
32 | Thread.sleep(2000);
33 | } catch (InterruptedException e) {
34 | e.printStackTrace();
35 | }
36 | System.out.println("**********************************");
37 | System.out.println("当前系统监测中的电梯共有" + all + "台");
38 | System.out.println("其中正常运行共有" + normal + "台");
39 | System.out.println("其中非正常运行共有" + err + "台");
40 | System.out.println("进入系统查看详情");
41 | System.out.println("**********************************");
42 |
43 | byte n = 0;
44 | showmenu();
45 | n = cin.nextByte();
46 | while (n != 0) {
47 | switch (n) {
48 | case 1:
49 | EleInfoSystem.choose();
50 | break;
51 | case 2:
52 | UserInfoSystem.choose();
53 | break;
54 | case 3:
55 | EleRunInfoSystem.choose();
56 | break;
57 | }
58 | showmenu();
59 | n = cin.nextByte();
60 | }
61 | System.out.println("Bye!");
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/view/UserInfoView.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import Dao.UserInfoDao;
4 | import tables.UserInfo;
5 |
6 | import java.util.List;
7 |
8 | public class UserInfoView {
9 |
10 | //输出单条记录
11 | public static void showOneUserInfo(UserInfo s) {
12 | System.out.print("\t" + s.getUserid());
13 | System.out.print("\t" + s.getUsername());
14 | if (s.isUseradmin()) {
15 | System.out.print("\t是");
16 | } else {
17 | System.out.print("\t否");
18 | }
19 | System.out.print("\t" + s.getUserrange());
20 | if (s.isUseronline()) {
21 | System.out.print("\t是");
22 | } else {
23 | System.out.print("\t否");
24 | }
25 | System.out.print("\n");
26 | }
27 |
28 | //输出所有记录
29 | public static void allUserInfo() {
30 | int n = 0;
31 | List list = UserInfoDao.allUserInfo();
32 | for (UserInfo s : list) {
33 | n++;
34 | showOneUserInfo(s);
35 | }
36 | }
37 |
38 | //输出指定userid的第一条记录
39 | public static void oneUserInfo(String userid) {
40 | UserInfo s;
41 | s = UserInfoDao.findbyuserid(userid);
42 | if (s != null) {
43 | showOneUserInfo(s);
44 | }
45 | }
46 |
47 | //输出指定所有指定区域的用户
48 | public static void showAllRangeUser(String userrange) {
49 | int n = 0;
50 | List list = UserInfoDao.findbyuserrange(userrange);
51 | for (UserInfo s : list) {
52 | n++;
53 | showOneUserInfo(s);
54 | }
55 | }
56 |
57 | //输出根据所处位置以及是否在线
58 | public static void showUserByRangeAndOnline(String userrange, boolean useronline) {
59 | int n = 0;
60 | List list = UserInfoDao.findbyRangeAndOnline(userrange, useronline);
61 | for (UserInfo s : list) {
62 | n++;
63 | showOneUserInfo(s);
64 | }
65 | }
66 |
67 | public static void searchByName(String name) {
68 | int n = 0;
69 | List list = UserInfoDao.searchUsername(name);
70 | for (UserInfo s : list) {
71 | n++;
72 | showOneUserInfo(s);
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/GUI/Panel/UserInfoPanelPackage/SettingPanelShowall.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.UserInfoPanelPackage;
2 |
3 | import Dao.UserInfoDao;
4 | import GUI.MyTabel;
5 | import tables.UserInfo;
6 |
7 | import javax.swing.*;
8 | import javax.swing.table.DefaultTableModel;
9 | import java.awt.*;
10 | import java.util.List;
11 |
12 | public class SettingPanelShowall extends JPanel {
13 | DefaultTableModel model;
14 | public static MyTabel table;
15 | private static Object[][] tableDatas;
16 |
17 | public SettingPanelShowall() {
18 | initialize();
19 | inittableDate();
20 | addComponent();
21 | }
22 |
23 | private void initialize() {
24 | this.setBackground(Color.white);
25 | this.setLayout(new BorderLayout());
26 | }
27 |
28 | /**
29 | * 添加组件
30 | */
31 | private void addComponent() {
32 | this.add(getCenterPanel(), BorderLayout.CENTER);
33 | this.add(getDownPanel(), BorderLayout.SOUTH);
34 | }
35 |
36 | public JPanel getCenterPanel() {
37 | JPanel panelCenter = new JPanel();
38 | panelCenter.setBackground(Color.white);
39 | panelCenter.setLayout(new GridLayout(1, 1));
40 |
41 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
42 | table = new MyTabel(model);
43 | table.Beautiful(false);
44 |
45 | //设置滚动条
46 | JScrollPane panelScroll = new JScrollPane(table);
47 | panelScroll.setBackground(Color.white);
48 | panelCenter.add(panelScroll, BorderLayout.CENTER);
49 |
50 |
51 | return panelCenter;
52 | }
53 |
54 | private JPanel getDownPanel() {
55 | JPanel panelDown = new JPanel();
56 | JLabel info = new JLabel("数据查询完成");
57 |
58 | Font font = new Font("微软雅黑", 0, 12);
59 | panelDown.setFont(font);
60 | panelDown.add(info);
61 |
62 | return panelDown;
63 | }
64 |
65 | private static void inittableDate() {
66 | List list = UserInfoDao.allUserInfo();
67 | Object[][] result = new Object[list.size()][5];
68 |
69 | int i = 0;
70 | for (UserInfo user : list) {
71 | result[i][0] = user.getUserid();
72 | result[i][1] = user.getUsername();
73 | result[i][2] = user.isUseradmin();
74 | result[i][3] = user.getUserrange();
75 | result[i][4] = user.isUseronline();
76 | i++;
77 | }
78 | tableDatas = result;
79 | }
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleRunInfoPanelPackage/SettingPanelShowall.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleRunInfoPanelPackage;
2 |
3 | import Dao.EleRunInfoDao;
4 | import GUI.MyTabel;
5 | import tables.EleRunInfo;
6 |
7 | import javax.swing.*;
8 | import javax.swing.table.DefaultTableModel;
9 | import java.awt.*;
10 | import java.util.List;
11 |
12 | public class SettingPanelShowall extends JPanel {
13 | DefaultTableModel model;
14 | public static MyTabel table;
15 | private static Object[][] tableDatas;
16 |
17 | public SettingPanelShowall() {
18 | initialize();
19 | inittableDate();
20 | addComponent();
21 | }
22 |
23 | /**
24 | * 初始化
25 | */
26 | private void initialize() {
27 | this.setBackground(Color.white);
28 | this.setLayout(new BorderLayout());
29 | }
30 |
31 | /**
32 | * 添加组件
33 | */
34 | private void addComponent() {
35 | this.add(getCenterPanel(), BorderLayout.CENTER);
36 | this.add(getDownPanel(), BorderLayout.SOUTH);
37 | }
38 |
39 | public JPanel getCenterPanel() {
40 | JPanel panelCenter = new JPanel();
41 | panelCenter.setBackground(Color.white);
42 | panelCenter.setLayout(new GridLayout(1, 1));
43 |
44 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯运行状况", "电梯持续运行时间(分钟)", "电梯错误信息", "", ""});
45 | table = new MyTabel(model);
46 | table.Beautiful(true);
47 |
48 | //设置滚动条
49 | JScrollPane panelScroll = new JScrollPane(table);
50 | panelScroll.setBackground(Color.white);
51 | panelCenter.add(panelScroll, BorderLayout.CENTER);
52 |
53 |
54 | return panelCenter;
55 | }
56 |
57 | private JPanel getDownPanel() {
58 | JPanel panelDown = new JPanel();
59 | JLabel info = new JLabel("数据查询完成");
60 |
61 | Font font = new Font("微软雅黑", 0, 12);
62 | panelDown.setFont(font);
63 | panelDown.add(info);
64 |
65 | return panelDown;
66 | }
67 |
68 | private static void inittableDate() {
69 | List list = EleRunInfoDao.allEleRunInfo();
70 | Object[][] result = new Object[list.size()][6];
71 |
72 | int i = 0;
73 | for (EleRunInfo ele : list) {
74 | result[i][0] = ele.getEleid();
75 | result[i][1] = ele.isEleisrunning();
76 | result[i][2] = ele.getElerunningtime();
77 | result[i][3] = ele.getEleerrormsg();
78 | i++;
79 | }
80 | tableDatas = result;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleRunInfoPanelPackage/SettingpanelShowErrmsg.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleRunInfoPanelPackage;
2 |
3 | import Dao.EleRunInfoDao;
4 | import GUI.MyTabel;
5 | import tables.EleRunInfo;
6 |
7 | import javax.swing.*;
8 | import javax.swing.table.DefaultTableModel;
9 | import java.awt.*;
10 | import java.util.List;
11 |
12 | public class SettingpanelShowErrmsg extends JPanel {
13 | DefaultTableModel model;
14 | public static MyTabel table;
15 | private static Object[][] tableDatas;
16 |
17 | public SettingpanelShowErrmsg() {
18 | initialize();
19 | inittableDate();
20 | addComponent();
21 | }
22 |
23 | /**
24 | * 初始化
25 | */
26 | private void initialize() {
27 | this.setBackground(Color.white);
28 | this.setLayout(new BorderLayout());
29 | }
30 |
31 | /**
32 | * 添加组件
33 | */
34 | private void addComponent() {
35 | this.add(getCenterPanel(), BorderLayout.CENTER);
36 | this.add(getDownPanel(), BorderLayout.SOUTH);
37 | }
38 |
39 | public JPanel getCenterPanel() {
40 | JPanel panelCenter = new JPanel();
41 | panelCenter.setBackground(Color.white);
42 | panelCenter.setLayout(new GridLayout(1, 1));
43 |
44 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯运行状况", "电梯持续运行时间(分钟)", "电梯错误信息", "", ""});
45 | table = new MyTabel(model);
46 | table.Beautiful(true);
47 |
48 | //设置滚动条
49 | JScrollPane panelScroll = new JScrollPane(table);
50 | panelScroll.setBackground(Color.white);
51 | panelCenter.add(panelScroll, BorderLayout.CENTER);
52 |
53 |
54 | return panelCenter;
55 | }
56 |
57 | private JPanel getDownPanel() {
58 | JPanel panelDown = new JPanel();
59 | JLabel info = new JLabel("数据查询完成");
60 |
61 | Font font = new Font("微软雅黑", 0, 12);
62 | panelDown.setFont(font);
63 | panelDown.add(info);
64 |
65 | return panelDown;
66 | }
67 |
68 | private static void inittableDate() {
69 | List list = EleRunInfoDao.stopEleInfomsg();
70 | Object[][] result = new Object[list.size()][6];
71 |
72 | int i = 0;
73 | for (EleRunInfo ele : list) {
74 | result[i][0] = ele.getEleid();
75 | result[i][1] = ele.isEleisrunning();
76 | result[i][2] = ele.getElerunningtime();
77 | result[i][3] = ele.getEleerrormsg();
78 | i++;
79 | }
80 | tableDatas = result;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/GUI/MyTabel.java:
--------------------------------------------------------------------------------
1 | package GUI;
2 |
3 | import javax.swing.*;
4 | import javax.swing.table.DefaultTableCellRenderer;
5 | import javax.swing.table.DefaultTableModel;
6 | import java.awt.*;
7 |
8 | public class MyTabel extends JTable {
9 |
10 | public MyTabel(DefaultTableModel obj) {
11 | super(obj);
12 | }
13 |
14 | public void Beautiful(boolean bool) {
15 | Font font = new Font("微软雅黑", 0, 12);
16 | this.setFont(font);
17 |
18 | //表头
19 | this.getTableHeader().setFont(font);
20 | this.getTableHeader().setBackground(new Color(37, 174, 96));
21 | this.setRowHeight(30);
22 | this.setGridColor(new Color(229, 229, 229));
23 | this.setSelectionBackground(new Color(37, 174, 96));
24 |
25 | //设置列宽
26 | if (bool) {
27 | this.getColumnModel().getColumn(0).setPreferredWidth(60);
28 | this.getColumnModel().getColumn(0).setMaxWidth(60);
29 | } else {
30 | this.getColumnModel().getColumn(0).setPreferredWidth(40);
31 | this.getColumnModel().getColumn(0).setMaxWidth(40);
32 | }
33 |
34 | if (bool) {
35 | this.getColumnModel().getColumn(1).setPreferredWidth(400);
36 | this.getColumnModel().getColumn(1).setMaxWidth(400);
37 | } else {
38 | this.getColumnModel().getColumn(1).setPreferredWidth(80);
39 | this.getColumnModel().getColumn(1).setMaxWidth(80);
40 | }
41 | if (bool) {
42 | this.getColumnModel().getColumn(2).setPreferredWidth(360);
43 | this.getColumnModel().getColumn(2).setMaxWidth(360);
44 | } else {
45 | this.getColumnModel().getColumn(2).setPreferredWidth(90);
46 | this.getColumnModel().getColumn(2).setMaxWidth(90);
47 | }
48 |
49 | if (bool) {
50 | this.getColumnModel().getColumn(3).setPreferredWidth(450);
51 | this.getColumnModel().getColumn(3).setMaxWidth(500);
52 | } else {
53 | this.getColumnModel().getColumn(3).setPreferredWidth(50);
54 | this.getColumnModel().getColumn(3).setMaxWidth(50);
55 | }
56 | this.getColumnModel().getColumn(4).setPreferredWidth(225);
57 | this.getColumnModel().getColumn(4).setMaxWidth(250);
58 |
59 |
60 | //居中显示
61 | DefaultTableCellRenderer r = new DefaultTableCellRenderer();
62 | r.setHorizontalAlignment(JLabel.CENTER);
63 | this.setDefaultRenderer(Object.class, r);
64 | this.getTableHeader().setDefaultRenderer(r);
65 |
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleInfoPanelPackage/SettingPanelShowall.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleInfoPanelPackage;
2 |
3 | import Dao.EleInfoDao;
4 | import GUI.MyTabel;
5 | import tables.EleInfo;
6 |
7 | import javax.swing.*;
8 | import javax.swing.table.DefaultTableModel;
9 | import java.awt.*;
10 | import java.util.List;
11 |
12 | public class SettingPanelShowall extends JPanel {
13 |
14 | DefaultTableModel model;
15 | public static MyTabel table;
16 | private static Object[][] tableDatas;
17 |
18 |
19 | public SettingPanelShowall() {
20 | initialize();
21 | inittableDate();
22 | addComponent();
23 | }
24 |
25 | /**
26 | * 初始化
27 | */
28 | private void initialize() {
29 | this.setBackground(Color.white);
30 | this.setLayout(new BorderLayout());
31 | }
32 |
33 | /**
34 | * 添加组件
35 | */
36 | private void addComponent() {
37 | this.add(getCenterPanel(), BorderLayout.CENTER);
38 | this.add(getDownPanel(), BorderLayout.SOUTH);
39 | }
40 |
41 | public JPanel getCenterPanel() {
42 | JPanel panelCenter = new JPanel();
43 | panelCenter.setBackground(Color.white);
44 | panelCenter.setLayout(new GridLayout(1, 1));
45 |
46 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
47 | table = new MyTabel(model);
48 | table.Beautiful(false);
49 |
50 | //设置滚动条
51 | JScrollPane panelScroll = new JScrollPane(table);
52 | panelScroll.setBackground(Color.white);
53 | panelCenter.add(panelScroll, BorderLayout.CENTER);
54 |
55 |
56 | return panelCenter;
57 | }
58 |
59 | private JPanel getDownPanel() {
60 | JPanel panelDown = new JPanel();
61 | JLabel info = new JLabel("数据查询完成");
62 |
63 | Font font = new Font("微软雅黑", 0, 12);
64 | panelDown.setFont(font);
65 | panelDown.add(info);
66 |
67 | return panelDown;
68 | }
69 |
70 | private static void inittableDate() {
71 | List list = EleInfoDao.allEleInfo();
72 | Object[][] result = new Object[list.size()][6];
73 |
74 | int i = 0;
75 | for (EleInfo ele : list) {
76 | result[i][0] = ele.getEleid();
77 | result[i][1] = ele.getEletype();
78 | result[i][2] = ele.getElecreatedate();
79 | result[i][3] = ele.getElerange();
80 | result[i][4] = ele.getEleaddress();
81 | result[i][5] = ele.getElelastmtdate();
82 | i++;
83 | }
84 | tableDatas = result;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/GUI/AppMainWindow.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Project File Encoding = GBK
3 | * Project File Encoding = GBK
4 | */
5 |
6 | package GUI;
7 |
8 | import GUI.Panel.*;
9 |
10 | import javax.swing.*;
11 | import java.awt.*;
12 | import java.awt.event.WindowEvent;
13 | import java.awt.event.WindowListener;
14 |
15 | public class AppMainWindow {
16 | private JFrame frame;
17 |
18 | private static JPanel mainPanel;
19 | public static JPanel mainPanelCenter;
20 |
21 | public static EleInfoPanel eleinfopanel;
22 | public static EleRunInfoPanel eleruninfopanel;
23 | public static UserInfoPanel userinfopanel;
24 | public static UserLoginPanel userloginpanel;
25 |
26 | public static void main(String[] args) {
27 |
28 | AppMainWindow window = new AppMainWindow();
29 | window.frame.setVisible(true);
30 |
31 | }
32 |
33 | /**
34 | * 构造,创建APP
35 | */
36 | public AppMainWindow() {
37 | initialize();
38 | }
39 |
40 | /**
41 | * 初始化frame内容
42 | */
43 | private void initialize() {
44 | System.out.println("AppStart");
45 |
46 | //去掉所有自带的效果
47 | try {
48 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
49 | } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
50 | e.printStackTrace();
51 | }
52 |
53 | //初始化窗口
54 | frame = new JFrame();
55 | frame.setBounds(240, 100, 885, 636);
56 | frame.setTitle("电梯管理系统");
57 | frame.setBackground(Color.white);
58 |
59 | mainPanel = new JPanel();
60 | mainPanel.setBackground(Color.white);
61 | mainPanel.setLayout(new BorderLayout());
62 |
63 | ToolBarPanel toolbar = new ToolBarPanel();
64 | ToolBarPanel.setLogin(false);
65 | eleinfopanel = new EleInfoPanel();
66 | eleruninfopanel = new EleRunInfoPanel();
67 | userinfopanel = new UserInfoPanel();
68 | userloginpanel = new UserLoginPanel();
69 |
70 | mainPanel.add(toolbar, BorderLayout.WEST);
71 |
72 | mainPanelCenter = new JPanel(true);
73 | mainPanelCenter.setLayout(new BorderLayout());
74 | mainPanelCenter.add(userloginpanel, BorderLayout.CENTER);
75 |
76 | mainPanel.add(mainPanelCenter, BorderLayout.CENTER);
77 | frame.add(mainPanel);
78 |
79 | frame.addWindowListener(new WindowListener() {
80 | @Override
81 | public void windowOpened(WindowEvent e) {
82 |
83 | }
84 |
85 | @Override
86 | public void windowClosing(WindowEvent e) {
87 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
88 | }
89 |
90 | @Override
91 | public void windowClosed(WindowEvent e) {
92 |
93 | }
94 |
95 | @Override
96 | public void windowIconified(WindowEvent e) {
97 |
98 | }
99 |
100 | @Override
101 | public void windowDeiconified(WindowEvent e) {
102 |
103 | }
104 |
105 | @Override
106 | public void windowActivated(WindowEvent e) {
107 |
108 | }
109 |
110 | @Override
111 | public void windowDeactivated(WindowEvent e) {
112 |
113 | }
114 | });
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/src/Dao/BaseDao.java:
--------------------------------------------------------------------------------
1 | package Dao;
2 |
3 | import java.sql.Connection;
4 | import java.sql.DriverManager;
5 | import java.sql.ResultSet;
6 | import java.sql.SQLException;
7 | import java.sql.Statement;
8 |
9 |
10 | public class BaseDao {
11 | private static String driver = "com.mysql.jdbc.Driver";
12 | private static String url = "jdbc:mysql://localhost:3306/elevator?characterEncoding=gbk";
13 | private static String dbUser = "root"; //数据库用户名
14 | private static String dbPwd = ""; //数据库密码
15 | private static Connection conn = null;
16 | private static Statement stmt = null;
17 |
18 | public static void dbConnect() {
19 | try {
20 | if (conn == null) {
21 | Class.forName(driver); //加载数据库驱动
22 | conn = DriverManager.getConnection(url, dbUser, dbPwd); //建立数据库连接
23 | } else
24 | return;
25 | } catch (Exception ee) {
26 | ee.printStackTrace();
27 | }
28 | }
29 |
30 | /**
31 | * 执行数据库查询操作
32 | *
33 | * @param sql
34 | * @return
35 | */
36 | public static ResultSet executeQuery(String sql) {
37 | try {
38 | if (conn == null)
39 | dbConnect();
40 | return conn.createStatement().executeQuery(sql); //执行数据库查询
41 | } catch (SQLException e) {
42 | e.printStackTrace();
43 | return null;
44 | } finally {
45 |
46 | }
47 | }
48 |
49 | /**
50 | * 执行数据库更新操作
51 | *
52 | * @param sql
53 | * @return
54 | */
55 | public static int executeUpdate(String sql) {
56 |
57 | try {
58 | if (conn == null)
59 | dbConnect();
60 | return conn.createStatement().executeUpdate(sql); //执行数据库更新
61 | } catch (SQLException e) {
62 | System.out.println(e.getMessage());
63 | return -1;
64 | } finally {
65 |
66 | }
67 | }
68 |
69 | public static void dbClose() {
70 | try {
71 | conn.close();
72 | } catch (SQLException e) {
73 | e.printStackTrace();
74 | } finally {
75 | conn = null;
76 | }
77 | }
78 |
79 | public static Statement dbConnectForTransaction() {
80 |
81 | try {
82 | if (conn == null) {
83 | Class.forName(driver); //加载数据库驱动
84 | conn = DriverManager.getConnection(url, dbUser, dbPwd); //建立数据库连接
85 | conn.setAutoCommit(false);
86 | stmt = conn.createStatement();
87 | } else
88 | return null;
89 | } catch (Exception ee) {
90 | ee.printStackTrace();
91 | }
92 | return stmt;
93 |
94 |
95 | }
96 |
97 | public static void transactionCommit() {
98 | try {
99 | conn.commit();
100 | } catch (SQLException e) {
101 | // TODO Auto-generated catch block
102 | e.printStackTrace();
103 | }
104 | }
105 |
106 | public static void transactionRollback() {
107 | try {
108 | conn.rollback();
109 | } catch (SQLException e) {
110 | // TODO Auto-generated catch block
111 | e.printStackTrace();
112 | }
113 | }
114 |
115 | public static void dbCloseForTransaction() {
116 | try {
117 | stmt.close();
118 | conn.close();
119 | } catch (SQLException e) {
120 | // TODO Auto-generated catch block
121 | e.printStackTrace();
122 | } finally {
123 | conn = null;
124 | }
125 |
126 | }
127 |
128 | }
129 |
130 |
--------------------------------------------------------------------------------
/src/GUI/Panel/ToolBarPanel.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel;
2 |
3 | import GUI.AppMainWindow;
4 | import GUI.MyIconButton;
5 |
6 | import javax.swing.*;
7 | import java.awt.*;
8 |
9 | public class ToolBarPanel extends JPanel {
10 | private static MyIconButton buttoneleinfo;
11 | private static MyIconButton buttoneleruninfo;
12 | private static MyIconButton buttonuserinfo;
13 | private static MyIconButton buttonuserlogin;
14 |
15 | public ToolBarPanel() {
16 | initialize();
17 | addButtion();
18 | addListener();
19 | }
20 |
21 | private void initialize() {
22 | Dimension preferredSize = new Dimension(48, 636);
23 | this.setPreferredSize(preferredSize);
24 | this.setMaximumSize(preferredSize);
25 | this.setMinimumSize(preferredSize);
26 | this.setBackground(new Color(37, 174, 96));
27 | this.setLayout(new GridLayout(2, 1));
28 | }
29 |
30 | private void addButtion() {
31 | JPanel panel = new JPanel();
32 | panel.setBackground(new Color(37, 174, 96));
33 | panel.setLayout(new FlowLayout(-2, -2, -4));
34 |
35 | ImageIcon eleinfoicon = new ImageIcon("src/resources/icon/eleinfo.png");
36 | ImageIcon eleinfoiconenable = new ImageIcon("src/resources/icon/eleinfoEnable.png");
37 |
38 | ImageIcon eleruninfoicon = new ImageIcon("src/resources/icon/eleruninfo.png");
39 | ImageIcon eleruninfoiconenable = new ImageIcon("src/resources/icon/eleruninfoEnable.png");
40 |
41 | ImageIcon userinfoicon = new ImageIcon("src/resources/icon/userinfo.png");
42 | ImageIcon userinfoiconenable = new ImageIcon("src/resources/icon/userinfoEnable.png");
43 |
44 | ImageIcon loginicon = new ImageIcon("src/resources/icon/login.png");
45 | ImageIcon loginiconenable = new ImageIcon("src/resources/icon/loginEnable.png");
46 |
47 |
48 | buttoneleinfo = new MyIconButton(eleinfoicon, eleinfoiconenable, eleinfoicon, "电梯信息");
49 | buttoneleruninfo = new MyIconButton(eleruninfoicon, eleruninfoiconenable, eleruninfoicon, "电梯运行信息");
50 | buttonuserinfo = new MyIconButton(userinfoicon, userinfoiconenable, userinfoicon, "用户信息");
51 | buttonuserlogin = new MyIconButton(loginicon, loginiconenable, loginicon, "登录");
52 |
53 | panel.add(buttoneleinfo);
54 | panel.add(buttoneleruninfo);
55 | panel.add(buttonuserinfo);
56 | panel.add(buttonuserlogin);
57 |
58 | this.add(panel);
59 | }
60 |
61 | private void addListener() {
62 | buttoneleinfo.addActionListener(e -> {
63 | AppMainWindow.mainPanelCenter.removeAll();
64 | AppMainWindow.mainPanelCenter.add(AppMainWindow.eleinfopanel, BorderLayout.CENTER);
65 | AppMainWindow.mainPanelCenter.updateUI();
66 |
67 | System.out.println("to EleInfo");
68 | });
69 | buttoneleruninfo.addActionListener(e -> {
70 | AppMainWindow.mainPanelCenter.removeAll();
71 | AppMainWindow.mainPanelCenter.add(AppMainWindow.eleruninfopanel, BorderLayout.CENTER);
72 | AppMainWindow.mainPanelCenter.updateUI();
73 |
74 | System.out.println("to EleRunInfo");
75 | });
76 | buttonuserinfo.addActionListener(e -> {
77 | AppMainWindow.mainPanelCenter.removeAll();
78 | AppMainWindow.mainPanelCenter.add(AppMainWindow.userinfopanel, BorderLayout.CENTER);
79 | AppMainWindow.mainPanelCenter.updateUI();
80 |
81 | System.out.println("to UserInfo");
82 | });
83 | buttonuserlogin.addActionListener(e -> {
84 | AppMainWindow.mainPanelCenter.removeAll();
85 | AppMainWindow.mainPanelCenter.add(AppMainWindow.userloginpanel, BorderLayout.CENTER);
86 | AppMainWindow.mainPanelCenter.updateUI();
87 |
88 | System.out.println("to UserLogin");
89 | });
90 |
91 | }
92 |
93 | public static void setLogin(boolean islogin) {
94 | buttoneleinfo.setEnabled(islogin);
95 | buttoneleruninfo.setEnabled(islogin);
96 | buttonuserinfo.setEnabled(islogin);
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/src/System/EleInfoSystem.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | import Dao.EleInfoDao;
4 | import tables.EleInfo;
5 | import view.EleInfoView;
6 |
7 | import java.sql.Date;
8 | import java.util.Scanner;
9 |
10 | public class EleInfoSystem {
11 | public static void showmenu() {
12 | System.out.println("1.显示所有记录");
13 | System.out.println("2.根据电梯id查询记录");
14 | System.out.println("3.查询某区域所有电梯");
15 | System.out.println("4.添加电梯记录");
16 | System.out.println("5.删除电梯记录");
17 | System.out.println("6.更新电梯最近维检日期");
18 | System.out.println("");
19 | System.out.println("0.返回上一级");
20 | }
21 |
22 | public static void showall() {
23 | EleInfoView.allEleInfo();
24 | }
25 |
26 | public static void showbyid() {
27 | Scanner cin = new Scanner(System.in);
28 | System.out.print("输入电梯id:");
29 | String id;
30 | id = cin.next();
31 | EleInfoView.oneEleInfo(id);
32 | }
33 |
34 | public static void showbyrange() {
35 | Scanner cin = new Scanner(System.in);
36 | System.out.print("输入电梯区域:");
37 | String range;
38 | range = cin.next();
39 | EleInfoView.allElerange(range);
40 | }
41 |
42 | public static void addone() {
43 | Scanner cin = new Scanner(System.in);
44 | EleInfo add = new EleInfo();
45 | System.out.println("----------正在添加一条新电梯记录----------");
46 | System.out.print("电梯ID: ");
47 | add.setEleid(cin.next());
48 | System.out.print("电梯型号: ");
49 | add.setEletype(cin.next());
50 | System.out.print("电梯安装日期(YYYY-MM-DD): ");
51 | String date = cin.next();
52 | if (InputCheck.datecheck(date) == false) {
53 | System.out.println("错误:输入时间逻辑错误 请重试\n");
54 | return;
55 | }
56 | add.setElecreatedate(Date.valueOf(date));
57 | System.out.print("电梯所在区域: ");
58 | add.setElerange(cin.next());
59 | System.out.print("电梯所在地址: ");
60 | add.setEleaddress(cin.next());
61 | System.out.print("最近维修检查时间(YYYY-MM-DD): ");
62 | date = cin.next();
63 | if (InputCheck.datecheck(date) == false) {
64 | System.out.println("错误:输入时间逻辑错误 请重试\n");
65 | return;
66 | }
67 | add.setElelastmtdate(Date.valueOf(date));
68 | if (add.getElelastmtdate().before(add.getElecreatedate()) == true) {
69 | System.out.println("错误:输入时间逻辑错误 请重试\n");
70 | return;
71 | }
72 | EleInfoDao.addOneEle(add);
73 | }
74 |
75 | public static void deleteone() {
76 | Scanner cin = new Scanner(System.in);
77 | System.out.print("输入删除电梯ID:");
78 | String del = cin.next();
79 | EleInfoDao.deleteOneEle(del);
80 | }
81 |
82 | public static void updateone() {
83 | Scanner cin = new Scanner(System.in);
84 | System.out.print("输入电梯ID: ");
85 | String eleid = cin.next();
86 | System.out.print("是否使用当前时间(y/n)");
87 | String choice = cin.next();
88 | String date;
89 | Date currentDate;
90 | if (choice.equals("Y") || choice.equals("y")) {
91 | currentDate = new Date(System.currentTimeMillis());
92 | } else if (choice.equals("N") || choice.equals("n")) {
93 | System.out.print("输入最近维修日期(yyyy-MM-dd): ");
94 | date = cin.next();
95 | if (InputCheck.datecheck(date) == false) {
96 | System.out.println("错误:输入时间逻辑错误 请重试\n");
97 | return;
98 | }
99 | currentDate = Date.valueOf(date);
100 | } else {
101 | System.out.print("非法输入,请重试");
102 | return;
103 | }
104 | EleInfoDao.updateMtdate(currentDate, eleid);
105 | }
106 |
107 | public static void choose() {
108 | Scanner cin = new Scanner(System.in);
109 | byte n = 0;
110 | showmenu();
111 | n = cin.nextByte();
112 | while (n != 0) {
113 | switch (n) {
114 | case 1:
115 | showall();
116 | break;
117 | case 2:
118 | showbyid();
119 | break;
120 | case 3:
121 | showbyrange();
122 | break;
123 | case 4:
124 | addone();
125 | break;
126 | case 5:
127 | deleteone();
128 | break;
129 | case 6:
130 | updateone();
131 | break;
132 | }
133 | showmenu();
134 | n = cin.nextByte();
135 | }
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleRunInfoPanelPackage/SettingPanelRunningTime.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleRunInfoPanelPackage;
2 |
3 | import Dao.EleRunInfoDao;
4 | import GUI.MyIconButton;
5 | import GUI.MyTabel;
6 | import tables.EleRunInfo;
7 |
8 | import javax.swing.*;
9 | import javax.swing.table.DefaultTableModel;
10 | import java.awt.*;
11 | import java.util.List;
12 |
13 | public class SettingPanelRunningTime extends JPanel {
14 | JLabel labeltime;
15 |
16 | JTextField texttime;
17 |
18 | MyIconButton buttontime;
19 |
20 | JLabel info;
21 |
22 | DefaultTableModel model;
23 | public static MyTabel table;
24 | private static Object[][] tableDatas;
25 | JScrollPane panelScroll;
26 |
27 | public SettingPanelRunningTime() {
28 | initialize();
29 | tableDatas = new Object[1][6];
30 | addComponent();
31 | addListener();
32 | }
33 |
34 | private void initialize() {
35 | this.setBackground(Color.white);
36 | this.setLayout(new BorderLayout());
37 | }
38 |
39 | private void addComponent() {
40 | this.add(getCenterPanel(), BorderLayout.CENTER);
41 | this.add(getDownPanel(), BorderLayout.SOUTH);
42 | }
43 |
44 | private JPanel getCenterPanel() {
45 | JPanel panelCenter = new JPanel();
46 | panelCenter.setBackground(Color.white);
47 | panelCenter.setLayout(new GridLayout(2, 1));
48 |
49 |
50 | //设置Grid
51 | JPanel panelGridSetting = new JPanel();
52 | panelGridSetting.setBackground(Color.white);
53 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 30));
54 |
55 | //初始化组件
56 | labeltime = new JLabel("设置Time阈值");
57 |
58 | texttime = new JTextField();
59 |
60 | ImageIcon icon_settime = new ImageIcon("src/resources/icon/settime.png");
61 | ImageIcon icon_settime_enable = new ImageIcon("src/resources/icon/settimeEnable.png");
62 | ImageIcon icon_settime_disable = new ImageIcon("src/resources/icon/fsettimeDisable.png");
63 |
64 | buttontime = new MyIconButton(icon_settime, icon_settime_enable, icon_settime_disable, "time");
65 |
66 | // 字体
67 | Font font = new Font("微软雅黑", 0, 13);
68 | labeltime.setFont(font);
69 | texttime.setFont(font);
70 |
71 | // 大小
72 | Dimension SIZE = new Dimension(100, 30);
73 | labeltime.setPreferredSize(SIZE);
74 |
75 | SIZE = new Dimension(250, 24);
76 | texttime.setPreferredSize(SIZE);
77 |
78 | panelGridSetting.add(labeltime);
79 | panelGridSetting.add(texttime);
80 | panelGridSetting.add(buttontime);
81 |
82 | //表格设置
83 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯运行状况", "电梯持续运行时间(分钟)", "电梯错误信息", "", ""});
84 | table = new MyTabel(model);
85 | table.Beautiful(true);
86 |
87 | //设置滚动条
88 | panelScroll = new JScrollPane(table) {
89 | public Dimension getPreferredSize() {
90 | return new Dimension(300, 60);
91 | }
92 | };
93 | panelScroll.setBackground(Color.white);
94 |
95 |
96 | panelCenter.add(panelGridSetting);
97 | panelCenter.add(panelScroll);
98 |
99 | return panelCenter;
100 |
101 | }
102 |
103 | private JPanel getDownPanel() {
104 | JPanel panelDown = new JPanel();
105 | info = new JLabel("输入查询内容");
106 |
107 | Font font = new Font("微软雅黑", 0, 12);
108 | panelDown.setFont(font);
109 | panelDown.add(info);
110 |
111 | return panelDown;
112 | }
113 |
114 | private void addListener() {
115 | buttontime.addActionListener(e -> {
116 | String input = texttime.getText();
117 | if (input.equals("")) {
118 | info.setText("Time不能为空");
119 | JOptionPane.showMessageDialog(this, "Time不能为空");
120 | return;
121 | }
122 | int time = Integer.parseInt(input);
123 |
124 | inittabledatabyid(time);
125 |
126 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯运行状况", "电梯持续运行时间(分钟)", "电梯错误信息", "", ""});
127 | table.setModel(model);
128 | table.Beautiful(true);
129 | info.setText("Success");
130 | });
131 | }
132 |
133 | public static void inittabledatabyid(int time) {
134 |
135 | List list = EleRunInfoDao.findruntimegreater(time);
136 | Object[][] result = new Object[list.size()][6];
137 | int i = 0;
138 | for (EleRunInfo ele : list) {
139 | result[i][0] = ele.getEleid();
140 | result[i][1] = ele.isEleisrunning();
141 | result[i][2] = ele.getElerunningtime();
142 | result[i][3] = ele.getEleerrormsg();
143 | i++;
144 | }
145 | tableDatas = result;
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/Dao/EleRunInfoDao.java:
--------------------------------------------------------------------------------
1 | package Dao;
2 |
3 | import tables.EleRunInfo;
4 |
5 | import java.sql.ResultSet;
6 | import java.sql.SQLException;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | public class EleRunInfoDao {
11 | //转换
12 | private static EleRunInfo convertEleRunInfo(ResultSet rs) {
13 | EleRunInfo Info = new EleRunInfo();
14 | try {
15 | Info.setEleid(rs.getString("eleid"));
16 | Info.setEleisrunning(rs.getBoolean("eleisrunning"));
17 | Info.setElerunningtime(rs.getInt("elerunningtime"));
18 | Info.setEleerrormsg(rs.getString("eleerrormsg"));
19 | } catch (SQLException e) {
20 | e.printStackTrace();
21 | }
22 | return Info;
23 | }
24 |
25 | //查询所有电梯的运行状况
26 | public static List allEleRunInfo() {
27 | try {
28 | List list = new ArrayList<>();
29 | String sql = "SELECT * FROM EleRunInfo";
30 | System.out.println("执行: " + sql);
31 | ResultSet rs = BaseDao.executeQuery(sql);
32 | while (rs.next()) {
33 | EleRunInfo info = convertEleRunInfo(rs);
34 | list.add(info);
35 | }
36 | rs.close();
37 | BaseDao.dbClose();
38 | return list;
39 | } catch (SQLException e) {
40 | e.printStackTrace();
41 | return null;
42 | }
43 | }
44 |
45 | //查询所有未正常运行电梯的错误信息
46 | public static List stopEleInfomsg() {
47 | try {
48 | List list = new ArrayList<>();
49 | String sql = "SELECT * FROM EleRunInfo WHERE eleisrunning = false";
50 | System.out.println("执行: " + sql);
51 | ResultSet rs = BaseDao.executeQuery(sql);
52 | while (rs.next()) {
53 | EleRunInfo info = convertEleRunInfo(rs);
54 | list.add(info);
55 | }
56 | rs.close();
57 | BaseDao.dbClose();
58 | return list;
59 | } catch (SQLException e) {
60 | e.printStackTrace();
61 | return null;
62 | }
63 | }
64 |
65 | //查询连续运行时间超过某个阈值的电梯记录
66 | public static List findruntimegreater(int time) {
67 | try {
68 | List list = new ArrayList<>();
69 | String sql = "SELECT * FROM EleRunInfo WHERE elerunningtime > " + time;
70 | System.out.println("执行: " + sql);
71 | ResultSet rs = BaseDao.executeQuery(sql);
72 | while (rs.next()) {
73 | EleRunInfo info = convertEleRunInfo(rs);
74 | list.add(info);
75 | }
76 | rs.close();
77 | BaseDao.dbClose();
78 | return list;
79 | } catch (SQLException e) {
80 | e.printStackTrace();
81 | return null;
82 | }
83 | }
84 |
85 | //查询所有电梯个数
86 | public static int countall() {
87 | try {
88 | int cnt = 0;
89 | String sql = "SELECT * FROM EleRunInfo";
90 | System.out.println("执行: " + sql);
91 | ResultSet rs = BaseDao.executeQuery(sql);
92 | while (rs.next()) {
93 | cnt++;
94 | }
95 | rs.close();
96 | BaseDao.dbClose();
97 | return cnt;
98 | } catch (SQLException e) {
99 | e.printStackTrace();
100 | return -1;
101 | }
102 | }
103 |
104 | //查询未正常运行的电梯个数
105 | public static int counterror() {
106 | try {
107 | int cnt = 0;
108 | String sql = "SELECT * FROM EleRunInfo WHERE eleisrunning = false";
109 | System.out.println("执行: " + sql);
110 | ResultSet rs = BaseDao.executeQuery(sql);
111 | while (rs.next()) {
112 | cnt++;
113 | }
114 | rs.close();
115 | BaseDao.dbClose();
116 | return cnt;
117 | } catch (SQLException e) {
118 | e.printStackTrace();
119 | return -1;
120 | }
121 | }
122 |
123 | //启动程序时自动更新运行时间
124 | public static void initruntime() {
125 | try {
126 | String sql = "SELECT * FROM EleRunInfo ";
127 | ResultSet rs = BaseDao.executeQuery(sql);
128 | while (rs.next()) {
129 | String eleid = rs.getString("eleid");
130 | sql = "UPDATE eleruninfo \n" +
131 | "SET elerunningtime = ( TIMESTAMPDIFF( HOUR, ( SELECT elelastmtdate FROM eleinfo WHERE eleid = '" + eleid + "' ), curdate( ) ) ) \n" +
132 | "WHERE\n" +
133 | "\t( eleid = '" + eleid + "' AND eleisrunning = TRUE )";
134 | int n = BaseDao.executeUpdate(sql);
135 | }
136 | rs.close();
137 | BaseDao.dbClose();
138 | } catch (SQLException e) {
139 | e.printStackTrace();
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/src/Dao/EleInfoDao.java:
--------------------------------------------------------------------------------
1 | package Dao;
2 |
3 | import tables.EleInfo;
4 |
5 | import java.sql.Date;
6 | import java.sql.ResultSet;
7 | import java.sql.SQLException;
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | public class EleInfoDao {
12 |
13 | //转换
14 | private static EleInfo convertEleInfo(ResultSet rs) {
15 | EleInfo Info = new EleInfo();
16 | try {
17 | Info.setEleid(rs.getString("eleid"));
18 | Info.setEletype(rs.getString("eletype"));
19 | Info.setElecreatedate(rs.getDate("elecreatedate"));
20 | Info.setElerange(rs.getString("elerange"));
21 | Info.setEleaddress(rs.getString("eleaddress"));
22 | Info.setElelastmtdate(rs.getDate("elelastmtdate"));
23 | } catch (SQLException e) {
24 | e.printStackTrace();
25 | }
26 | return Info;
27 | }
28 |
29 | //查询所有记录
30 | public static List allEleInfo() {
31 | try {
32 | List list = new ArrayList<>();
33 | String sql = "SELECT * FROM EleInfo";
34 | System.out.println("执行: " + sql);
35 | ResultSet rs = BaseDao.executeQuery(sql);
36 | while (rs.next()) {
37 | EleInfo info = convertEleInfo(rs);
38 | list.add(info);
39 | }
40 | rs.close();
41 | BaseDao.dbClose();
42 | return list;
43 | } catch (SQLException e) {
44 | e.printStackTrace();
45 | return null;
46 | }
47 | }
48 |
49 | //根据eleid查询记录
50 | public static EleInfo findbyeleid(String eleid) {
51 | try {
52 | EleInfo one = new EleInfo();
53 | String sql = "SELECT * FROM EleInfo WHERE eleid = '" + eleid + "'";
54 | System.out.println("执行: " + sql);
55 | ResultSet rs = BaseDao.executeQuery(sql);
56 | if (rs.next()) {
57 | one = convertEleInfo(rs);
58 | }
59 | rs.close();
60 | BaseDao.dbClose();
61 | return one;
62 | } catch (SQLException e) {
63 | e.printStackTrace();
64 | return null;
65 | }
66 | }
67 |
68 | //根据elerange来查询数据
69 | public static List findbyelerange(String elerange) {
70 | try {
71 | List list = new ArrayList<>();
72 | String sql = "SELECT * FROM EleInfo WHERE elerange = '" + elerange + "'";
73 | ResultSet rs = BaseDao.executeQuery(sql);
74 | while (rs.next()) {
75 | EleInfo info = convertEleInfo(rs);
76 | list.add(info);
77 | }
78 | rs.close();
79 | BaseDao.dbClose();
80 | return list;
81 | } catch (SQLException e) {
82 | e.printStackTrace();
83 | return null;
84 | }
85 | }
86 |
87 | //根据elerange和eleid来查询
88 | public static List findbyrangeandid(String id, String range) {
89 | try {
90 | List list = new ArrayList<>();
91 | String sql = "SELECT * FROM EleInfo WHERE ( elerange = '" + range + "' AND eleid = '" + id + "' )";
92 | ResultSet rs = BaseDao.executeQuery(sql);
93 | while (rs.next()) {
94 | EleInfo info = convertEleInfo(rs);
95 | list.add(info);
96 | }
97 | rs.close();
98 | BaseDao.dbClose();
99 | return list;
100 | } catch (SQLException e) {
101 | e.printStackTrace();
102 | return null;
103 | }
104 | }
105 |
106 | //添加电梯
107 | public static void addOneEle(EleInfo Ele) {
108 | String sql = "insert into EleInfo values('"
109 | + Ele.getEleid() + "', '"
110 | + Ele.getEletype() + "', '"
111 | + Ele.getElecreatedate() + "', '"
112 | + Ele.getElerange() + "', '"
113 | + Ele.getEleaddress() + "', '"
114 | + Ele.getElelastmtdate() + "')";
115 | System.out.println("执行: " + sql);
116 | int r = BaseDao.executeUpdate(sql);
117 | sql = "insert into EleRunInfo values('"
118 | + Ele.getEleid() + "', "
119 | + false + ", "
120 | + 0 + ", "
121 | + null + ")";
122 | System.out.println("执行: " + sql);
123 | int n = BaseDao.executeUpdate(sql);
124 | if (r > 0 && n > 0) {
125 | System.out.println("成功添加" + r + "个电梯");
126 | }
127 | BaseDao.dbClose();
128 | }
129 |
130 | //删除电梯
131 | public static void deleteOneEle(String eleid) {
132 | String sql = "delete from EleInfo where eleid = '" + eleid + "'";
133 | System.out.println("执行: " + sql);
134 | int r = BaseDao.executeUpdate(sql);
135 | sql = "delete from EleRunInfo where eleid = '" + eleid + "'";
136 | System.out.println("执行: " + sql);
137 | int n = BaseDao.executeUpdate(sql);
138 | if (r > 0 & n > 0)
139 | System.out.println("成功删除" + r + "个电梯");
140 | BaseDao.dbClose();
141 | }
142 |
143 | //更新日期
144 | public static void updateMtdate(Date date, String eleid) {
145 | String sql = "UPDATE EleInfo SET elelastmtdate = '" + date + "' WHERE eleid = '" + eleid + "'";
146 | System.out.println("执行: " + sql);
147 | int r = BaseDao.executeUpdate(sql);
148 | if (r > 0) {
149 | System.out.println("成功更新" + r + "个电梯最近维修日期");
150 | }
151 | BaseDao.dbClose();
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/src/System/UserInfoSystem.java:
--------------------------------------------------------------------------------
1 | package System;
2 |
3 | import Dao.UserInfoDao;
4 | import tables.UserInfo;
5 | import view.UserInfoView;
6 |
7 | import java.util.Scanner;
8 |
9 | public class UserInfoSystem {
10 | public static void showmenu() {
11 | System.out.println("1.显示所有记录");
12 | System.out.println("2.根据维修人员id查询记录");
13 | System.out.println("3.查询某区域所有维修人员");
14 | System.out.println("4.查询某地区目前可调用的维修人员");
15 | System.out.println("5.添加新的人员记录");
16 | System.out.println("6.删除人员记录");
17 | System.out.println("7.更新人员在岗状态");
18 | System.out.println("8.查找人员");
19 | System.out.println("");
20 | System.out.println("0.返回上一级");
21 | }
22 |
23 | public static void showall() {
24 | UserInfoView.allUserInfo();
25 | }
26 |
27 | public static void showbyid() {
28 | Scanner cin = new Scanner(System.in);
29 | System.out.print("输入维修人员id:");
30 | String id;
31 | id = cin.next();
32 | UserInfoView.oneUserInfo(id);
33 | }
34 |
35 | public static void showbyrange() {
36 | Scanner cin = new Scanner(System.in);
37 | System.out.print("输入所在区域:");
38 | String range;
39 | range = cin.next();
40 | UserInfoView.showAllRangeUser(range);
41 | }
42 |
43 | public static void showbyrangeandonline() {
44 | Scanner cin = new Scanner(System.in);
45 | System.out.print("输入所在区域:");
46 | String range2 = cin.next();
47 | System.out.print("查询是否在岗 y/n: ");
48 | String choice = cin.next();
49 | boolean online;
50 | if (choice.equals("Y") || choice.equals("y"))
51 | online = true;
52 | else if (choice.equals("N") || choice.equals("n"))
53 | online = false;
54 | else {
55 | System.out.print("非法输入,请重试");
56 | return;
57 | }
58 | UserInfoView.showUserByRangeAndOnline(range2, online);
59 | }
60 |
61 | public static void addone() {
62 | Scanner cin = new Scanner(System.in);
63 | UserInfo add = new UserInfo();
64 | System.out.println("----------正在添加一条新用户记录----------");
65 | System.out.print("用户ID: ");
66 | add.setUserid(cin.next());
67 | System.out.print("用户姓名: ");
68 | add.setUsername(cin.next());
69 | System.out.print("是否为管理员(y/n): ");
70 | String choice = cin.next();
71 | if (choice.equals("Y") || choice.equals("y"))
72 | add.setUseradmin(true);
73 | else if (choice.equals("N") || choice.equals("n"))
74 | add.setUseradmin(false);
75 | else {
76 | System.out.print("非法输入,请重试");
77 | return;
78 | }
79 | System.out.print("输入用户密码(6位数字): ");
80 | String pwd = cin.next();
81 | if (!InputCheck.pwdcheck(pwd)) {
82 | System.out.print("非法输入,请重试");
83 | return;
84 | }
85 | System.out.print("用户所在区域: ");
86 | add.setUserrange(cin.next());
87 | System.out.print("用户当前是否在岗(y/n): ");
88 | choice = cin.next();
89 | if (choice.equals("Y") || choice.equals("y"))
90 | add.setUseronline(true);
91 | else if (choice.equals("N") || choice.equals("n"))
92 | add.setUseronline(false);
93 | else {
94 | System.out.print("非法输入,请重试");
95 | return;
96 | }
97 | UserInfoDao.addOneUser(add, pwd);
98 | }
99 |
100 | public static void deleteone() {
101 | Scanner cin = new Scanner(System.in);
102 | System.out.print("输入删除用户ID: ");
103 | String del = cin.next();
104 | UserInfoDao.deleteOneUser(del);
105 | }
106 |
107 | public static void updateoneonline() {
108 | Scanner cin = new Scanner(System.in);
109 | System.out.print("输入用户ID: ");
110 | String userid = cin.next();
111 | System.out.print("输入用户状态(y/n): ");
112 | String choice = cin.next();
113 | if (choice.equals("Y") || choice.equals("y"))
114 | UserInfoDao.updateOneuserOnlineByuserid(userid, true);
115 | else if (choice.equals("N") || choice.equals("n"))
116 | UserInfoDao.updateOneuserOnlineByuserid(userid, false);
117 | else {
118 | System.out.print("非法输入,请重试");
119 | return;
120 | }
121 | }
122 |
123 | public static void searchone() {
124 | Scanner cin = new Scanner(System.in);
125 | System.out.print("输入用户姓名: ");
126 | String name = cin.next();
127 | UserInfoView.searchByName(name);
128 | }
129 |
130 | public static void choose() {
131 | Scanner cin = new Scanner(System.in);
132 | byte n = 0;
133 | showmenu();
134 | n = cin.nextByte();
135 | while (n != 0) {
136 | switch (n) {
137 | case 1:
138 | showall();
139 | break;
140 | case 2:
141 | showbyid();
142 | break;
143 | case 3:
144 | showbyrange();
145 | break;
146 | case 4:
147 | showbyrangeandonline();
148 | break;
149 | case 5:
150 | addone();
151 | break;
152 | case 6:
153 | deleteone();
154 | break;
155 | case 7:
156 | updateoneonline();
157 | break;
158 | case 8:
159 | searchone();
160 | break;
161 | }
162 | showmenu();
163 | n = cin.nextByte();
164 | }
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/src/GUI/Panel/UserInfoPanelPackage/SettingPanelDeleteone.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.UserInfoPanelPackage;
2 |
3 | import Dao.UserInfoDao;
4 | import GUI.MyIconButton;
5 | import GUI.MyTabel;
6 | import GUI.Panel.UserInfoPanel;
7 | import tables.UserInfo;
8 |
9 | import javax.swing.*;
10 | import javax.swing.table.DefaultTableModel;
11 | import java.awt.*;
12 |
13 | public class SettingPanelDeleteone extends JPanel {
14 | JLabel labelid;
15 | JTextField textid;
16 | MyIconButton buttonid;
17 |
18 | DefaultTableModel model;
19 | public static MyTabel table;
20 | private static Object[][] tableDatas;
21 | JScrollPane panelScroll;
22 |
23 | static MyIconButton buttondelete;
24 | JLabel info;
25 |
26 | public SettingPanelDeleteone() {
27 | initialize();
28 | addComponent();
29 | addListener();
30 | }
31 |
32 | private void initialize() {
33 | this.setBackground(Color.white);
34 | this.setLayout(new BorderLayout());
35 | }
36 |
37 | private void addComponent() {
38 | this.add(getCenterPanel(), BorderLayout.CENTER);
39 | this.add(getDownPanel(), BorderLayout.SOUTH);
40 | }
41 |
42 | private JPanel getCenterPanel() {
43 | JPanel panelCenter = new JPanel();
44 | panelCenter.setBackground(Color.white);
45 | panelCenter.setLayout(new GridLayout(2, 1));
46 |
47 | //设置Grid
48 | JPanel panelGridSetting = new JPanel();
49 | panelGridSetting.setBackground(Color.white);
50 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 20));
51 |
52 | //初始化组件
53 | labelid = new JLabel("输入id编号");
54 |
55 | textid = new JTextField();
56 |
57 | ImageIcon icon_id = new ImageIcon("src/resources/icon/findbyid.png");
58 | ImageIcon icon_id_enable = new ImageIcon("src/resources/icon/findbyidEnable.png");
59 | ImageIcon icon_id_disable = new ImageIcon("src/resources/icon/findbyidDisable.png");
60 | buttonid = new MyIconButton(icon_id, icon_id_enable, icon_id_disable, "id");
61 |
62 | // 字体
63 | Font font = new Font("微软雅黑", 0, 13);
64 | labelid.setFont(font);
65 | textid.setFont(font);
66 | buttonid.setFont(font);
67 |
68 | // 大小
69 | labelid.setPreferredSize(new Dimension(100, 30));
70 | textid.setPreferredSize(new Dimension(250, 24));
71 |
72 | panelGridSetting.add(labelid);
73 | panelGridSetting.add(textid);
74 | panelGridSetting.add(buttonid);
75 |
76 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
77 | table = new MyTabel(model);
78 | panelScroll = new JScrollPane(table) {
79 | public Dimension getPreferredSize() {
80 | return new Dimension(300, 200);
81 | }
82 | };
83 | panelScroll.setBackground(Color.white);
84 |
85 |
86 | panelCenter.add(panelGridSetting);
87 | panelCenter.add(panelScroll);
88 | return panelCenter;
89 | }
90 |
91 | private JPanel getDownPanel() {
92 | JPanel panelDown = new JPanel();
93 | panelDown.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
94 | panelDown.setPreferredSize(new Dimension(0, 50));
95 |
96 | JPanel panelbutton = new JPanel();
97 | panelbutton.setLayout(new FlowLayout(FlowLayout.RIGHT, 30, 0));
98 | panelbutton.setPreferredSize(new Dimension(630, 35));
99 |
100 |
101 | ImageIcon icon_start = new ImageIcon("src/resources/icon/confirm.png");
102 | ImageIcon icon_start_enable = new ImageIcon("src/resources/icon/confirmEnable.png");
103 | ImageIcon icon_start_disable = new ImageIcon("src/resources/icon/confirmDisable.png");
104 |
105 | buttondelete = new MyIconButton(icon_start, icon_start_enable, icon_start_disable, "add");
106 | panelbutton.add(buttondelete);
107 | info = new JLabel("输入添加内容");
108 | Font font = new Font("微软雅黑", 0, 12);
109 | panelDown.setFont(font);
110 |
111 | panelDown.add(panelbutton);
112 | panelDown.add(info);
113 |
114 | return panelDown;
115 | }
116 |
117 | private void addListener() {
118 | buttonid.addActionListener(e -> {
119 | String id = textid.getText();
120 | if (id.equals("")) {
121 | info.setText("ID不能为空");
122 | return;
123 | }
124 | inittabledatabyid(id);
125 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
126 | table.setModel(model);
127 | table.Beautiful(false);
128 | info.setText("根据id查询记录完成");
129 | });
130 |
131 | buttondelete.addActionListener(e -> {
132 | String id = textid.getText();
133 | if (id.equals("")) {
134 | info.setText("ID不能为空");
135 | return;
136 | }
137 | if (tableDatas.length == 0) {
138 | info.setText("没有查询到需要删除的记录");
139 | return;
140 | }
141 | UserInfoDao.deleteOneUser(id);
142 | info.setText("已删除");
143 | UserInfoPanel.settingPanelMain.removeAll();
144 | UserInfoPanel.settingPanelMain.add(new SettingPanelShowall());
145 | UserInfoPanel.settingPanelMain.updateUI();
146 | });
147 | }
148 |
149 |
150 | public static void inittabledatabyid(String id) {
151 | UserInfo list = UserInfoDao.findbyuserid(id);
152 | Object[][] result = new Object[1][5];
153 |
154 | int i = 0;
155 |
156 | result[i][0] = list.getUserid();
157 | result[i][1] = list.getUsername();
158 | result[i][2] = list.isUseradmin();
159 | result[i][3] = list.getUserrange();
160 | result[i][4] = list.isUseronline();
161 |
162 | tableDatas = result;
163 | }
164 |
165 | public static void setadmin() {
166 | buttondelete.setEnabled(false);
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleInfoPanelPackage/SettingPanelDeleteone.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleInfoPanelPackage;
2 |
3 | import Dao.EleInfoDao;
4 | import GUI.MyIconButton;
5 | import GUI.MyTabel;
6 | import GUI.Panel.EleInfoPanel;
7 | import tables.EleInfo;
8 |
9 | import javax.swing.*;
10 | import javax.swing.table.DefaultTableModel;
11 | import java.awt.*;
12 |
13 | public class SettingPanelDeleteone extends JPanel {
14 | JLabel labelid;
15 | JTextField textid;
16 | MyIconButton buttonid;
17 |
18 | DefaultTableModel model;
19 | public static MyTabel table;
20 | private static Object[][] tableDatas;
21 | JScrollPane panelScroll;
22 |
23 | static MyIconButton buttondelete;
24 | JLabel info;
25 |
26 | public SettingPanelDeleteone() {
27 | initialize();
28 | addComponent();
29 | addListener();
30 | }
31 |
32 | private void initialize() {
33 | this.setBackground(Color.white);
34 | this.setLayout(new BorderLayout());
35 | }
36 |
37 | private void addComponent() {
38 | this.add(getCenterPanel(), BorderLayout.CENTER);
39 | this.add(getDownPanel(), BorderLayout.SOUTH);
40 | }
41 |
42 | private JPanel getCenterPanel() {
43 | JPanel panelCenter = new JPanel();
44 | panelCenter.setBackground(Color.white);
45 | panelCenter.setLayout(new GridLayout(2, 1));
46 |
47 | //设置Grid
48 | JPanel panelGridSetting = new JPanel();
49 | panelGridSetting.setBackground(Color.white);
50 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 20));
51 |
52 | //初始化组件
53 | labelid = new JLabel("输入id编号");
54 |
55 | textid = new JTextField();
56 |
57 | ImageIcon icon_id = new ImageIcon("src/resources/icon/findbyid.png");
58 | ImageIcon icon_id_enable = new ImageIcon("src/resources/icon/findbyidEnable.png");
59 | ImageIcon icon_id_disable = new ImageIcon("src/resources/icon/findbyidDisable.png");
60 | buttonid = new MyIconButton(icon_id, icon_id_enable, icon_id_disable, "id");
61 |
62 | // 字体
63 | Font font = new Font("微软雅黑", 0, 13);
64 | labelid.setFont(font);
65 | textid.setFont(font);
66 | buttonid.setFont(font);
67 |
68 | // 大小
69 | labelid.setPreferredSize(new Dimension(100, 30));
70 | textid.setPreferredSize(new Dimension(250, 24));
71 |
72 | panelGridSetting.add(labelid);
73 | panelGridSetting.add(textid);
74 | panelGridSetting.add(buttonid);
75 |
76 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
77 | table = new MyTabel(model);
78 | panelScroll = new JScrollPane(table) {
79 | public Dimension getPreferredSize() {
80 | return new Dimension(300, 200);
81 | }
82 | };
83 | panelScroll.setBackground(Color.white);
84 |
85 |
86 | panelCenter.add(panelGridSetting);
87 | panelCenter.add(panelScroll);
88 | return panelCenter;
89 | }
90 |
91 | private JPanel getDownPanel() {
92 | JPanel panelDown = new JPanel();
93 | panelDown.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
94 | panelDown.setPreferredSize(new Dimension(0, 50));
95 |
96 | JPanel panelbutton = new JPanel();
97 | panelbutton.setLayout(new FlowLayout(FlowLayout.RIGHT, 30, 0));
98 | panelbutton.setPreferredSize(new Dimension(630, 35));
99 |
100 |
101 | ImageIcon icon_start = new ImageIcon("src/resources/icon/confirm.png");
102 | ImageIcon icon_start_enable = new ImageIcon("src/resources/icon/confirmEnable.png");
103 | ImageIcon icon_start_disable = new ImageIcon("src/resources/icon/confirmDisable.png");
104 |
105 | buttondelete = new MyIconButton(icon_start, icon_start_enable, icon_start_disable, "add");
106 | panelbutton.add(buttondelete);
107 | info = new JLabel("输入添加内容");
108 | Font font = new Font("微软雅黑", 0, 12);
109 | panelDown.setFont(font);
110 |
111 | panelDown.add(panelbutton);
112 | panelDown.add(info);
113 |
114 | return panelDown;
115 | }
116 |
117 | private void addListener() {
118 | buttonid.addActionListener(e -> {
119 | if (textid.getText().equals("")) {
120 | info.setText("id不允许为空");
121 | return;
122 | }
123 | inittableDateByid(textid.getText());
124 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
125 | table.setModel(model);
126 | table.Beautiful(false);
127 | info.setText("根据id查询记录完成");
128 | });
129 |
130 | buttondelete.addActionListener(e -> {
131 | String id = textid.getText();
132 | if (id.equals("")) {
133 | info.setText("ID不能为空");
134 | JOptionPane.showMessageDialog(this, "ID不能为空");
135 |
136 | return;
137 | }
138 | if (tableDatas.length == 0) {
139 | info.setText("没有查询到需要删除的记录");
140 | JOptionPane.showMessageDialog(this, "没有查询到需要删除的记录");
141 | return;
142 | }
143 | EleInfoDao.deleteOneEle(id);
144 | info.setText("已删除");
145 | EleInfoPanel.settingPanelMain.removeAll();
146 | EleInfoPanel.settingPanelMain.add(new SettingPanelShowall());
147 | EleInfoPanel.settingPanelMain.updateUI();
148 | });
149 | }
150 |
151 | private static void inittableDateByid(String id) {
152 | EleInfo list = EleInfoDao.findbyeleid(id);
153 | Object[][] result = new Object[1][6];
154 | result[0][0] = list.getEleid();
155 | result[0][1] = list.getEletype();
156 | result[0][2] = list.getElecreatedate();
157 | result[0][3] = list.getElerange();
158 | result[0][4] = list.getEleaddress();
159 | result[0][5] = list.getElelastmtdate();
160 | tableDatas = result;
161 | }
162 |
163 | public static void setadmin() {
164 | buttondelete.setEnabled(false);
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/src/GUI/Panel/UserInfoPanelPackage/SettingPanelUpdateone.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.UserInfoPanelPackage;
2 |
3 | import Dao.UserInfoDao;
4 | import Dao.UserLoginInfoDao;
5 | import GUI.MyIconButton;
6 |
7 | import javax.swing.*;
8 | import java.awt.*;
9 |
10 | public class SettingPanelUpdateone extends JPanel {
11 | JLabel labelid;
12 | JLabel labeloldpassword;
13 | JLabel labelnewpassword;
14 | JLabel labelcheck;
15 |
16 | JTextField textid;
17 | JPasswordField textoldpassword;
18 | JPasswordField textnewpassword;
19 | JPasswordField textcheck;
20 |
21 | MyIconButton buttonupdatepassword;
22 | static MyIconButton buttonupdatedamin;
23 |
24 | JLabel info;
25 |
26 | public SettingPanelUpdateone() {
27 | initialize();
28 | addComponent();
29 | addListener();
30 | }
31 |
32 | private void initialize() {
33 | this.setBackground(Color.white);
34 | this.setLayout(new BorderLayout());
35 | }
36 |
37 | private void addComponent() {
38 | this.add(getCenterPanel(), BorderLayout.CENTER);
39 | this.add(getDownPanel(), BorderLayout.SOUTH);
40 | }
41 |
42 | private JPanel getCenterPanel() {
43 | JPanel panelCenter = new JPanel();
44 | panelCenter.setBackground(Color.white);
45 | panelCenter.setLayout(new GridLayout(1, 1));
46 |
47 | //设置Grid
48 | JPanel panelGridSetting = new JPanel();
49 | panelGridSetting.setBackground(Color.white);
50 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 20));
51 |
52 | //初始化组件
53 | labelid = new JLabel("输入id编号");
54 | labeloldpassword = new JLabel("输入旧密码");
55 | labelnewpassword = new JLabel("输入新密码");
56 | labelcheck = new JLabel("重复输入新密码");
57 |
58 | textid = new JTextField("");
59 | textoldpassword = new JPasswordField("");
60 | textnewpassword = new JPasswordField("");
61 | textcheck = new JPasswordField("");
62 |
63 | ImageIcon icon_updateadmin = new ImageIcon("src/resources/icon/updateadmin.png");
64 | ImageIcon icon_icon_updateadmin_enable = new ImageIcon("src/resources/icon/updateadminEnable.png");
65 | ImageIcon icon_icon_updateadmin_disable = new ImageIcon("src/resources/icon/updateadminDisable.png");
66 |
67 | ImageIcon icon_updatepassword = new ImageIcon("src/resources/icon/updatepassword.png");
68 | ImageIcon icon_updatepassword_enable = new ImageIcon("src/resources/icon/updatepasswordEnable.png");
69 | ImageIcon icon_updatepassword_disable = new ImageIcon("src/resources/icon/updatepasswordDisable.png");
70 |
71 | buttonupdatedamin = new MyIconButton(icon_updateadmin, icon_icon_updateadmin_enable, icon_icon_updateadmin_disable, "admin");
72 | buttonupdatepassword = new MyIconButton(icon_updatepassword, icon_updatepassword_enable, icon_updatepassword_disable, "password");
73 |
74 | // 字体
75 | Font font = new Font("微软雅黑", 0, 13);
76 | labelid.setFont(font);
77 | textid.setFont(font);
78 | labeloldpassword.setFont(font);
79 | labelnewpassword.setFont(font);
80 | textnewpassword.setFont(font);
81 | textoldpassword.setFont(font);
82 | labelcheck.setFont(font);
83 | textcheck.setFont(font);
84 |
85 |
86 | // 大小
87 | labelid.setPreferredSize(new Dimension(100, 30));
88 | labeloldpassword.setPreferredSize(new Dimension(100, 30));
89 | labelnewpassword.setPreferredSize(new Dimension(100, 30));
90 | labelcheck.setPreferredSize(new Dimension(100, 30));
91 | textid.setPreferredSize(new Dimension(380, 24));
92 | textnewpassword.setPreferredSize(new Dimension(380, 24));
93 | textoldpassword.setPreferredSize(new Dimension(380, 24));
94 | textcheck.setPreferredSize(new Dimension(380, 24));
95 |
96 |
97 | panelGridSetting.add(labelid);
98 | panelGridSetting.add(textid);
99 | panelGridSetting.add(labeloldpassword);
100 | panelGridSetting.add(textoldpassword);
101 | panelGridSetting.add(labelnewpassword);
102 | panelGridSetting.add(textnewpassword);
103 | panelGridSetting.add(labelcheck);
104 | panelGridSetting.add(textcheck);
105 | panelGridSetting.add(buttonupdatepassword);
106 | panelGridSetting.add(buttonupdatedamin);
107 |
108 |
109 | panelCenter.add(panelGridSetting);
110 | return panelCenter;
111 | }
112 |
113 |
114 | private JPanel getDownPanel() {
115 | JPanel panelDown = new JPanel();
116 | info = new JLabel("输入添加内容");
117 | Font font = new Font("微软雅黑", 0, 12);
118 | panelDown.setFont(font);
119 | panelDown.add(info);
120 |
121 | return panelDown;
122 | }
123 |
124 | private void addListener() {
125 | buttonupdatepassword.addActionListener(e -> {
126 | String id = textid.getText();
127 | String oldpwd = new String(textoldpassword.getPassword());
128 | String newpwd = new String(textnewpassword.getPassword());
129 | String check = new String(textcheck.getPassword());
130 | String correctpwd = UserLoginInfoDao.findpwdbyid(id);
131 |
132 | if (id.equals("")) {
133 | info.setText("id不允许为空");
134 | JOptionPane.showMessageDialog(this, "id不允许为空");
135 | return;
136 | }
137 | if (!correctpwd.equals(oldpwd)) {
138 | info.setText("当前密码输入错误");
139 | JOptionPane.showMessageDialog(this, "当前密码输入错误");
140 |
141 | return;
142 | }
143 | if (!check.equals(newpwd)) {
144 | info.setText("密码重复错误");
145 | JOptionPane.showMessageDialog(this, "密码重复错误");
146 |
147 | return;
148 | }
149 | UserLoginInfoDao.updatepassword(newpwd, id);
150 | info.setText("修改密码成功");
151 | });
152 |
153 | buttonupdatedamin.addActionListener(e -> {
154 | String id = textid.getText();
155 | if (id.equals("")) {
156 | info.setText("id不允许为空");
157 | JOptionPane.showMessageDialog(this, "id不允许为空");
158 | return;
159 | }
160 |
161 | UserInfoDao.updateadmin(id);
162 | info.setText("提升管理员权限成功");
163 | });
164 |
165 |
166 | }
167 |
168 | public static void setadmin() {
169 | buttonupdatedamin.setEnabled(false);
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleInfoPanelPackage/SettingPanelUpdateone.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleInfoPanelPackage;
2 |
3 | import Dao.EleInfoDao;
4 | import GUI.AppMainWindow;
5 | import GUI.MyIconButton;
6 | import GUI.MyTabel;
7 | import tables.EleInfo;
8 |
9 | import javax.swing.*;
10 | import javax.swing.table.DefaultTableModel;
11 | import java.awt.*;
12 | import java.sql.Date;
13 | import java.text.SimpleDateFormat;
14 |
15 | public class SettingPanelUpdateone extends JPanel {
16 |
17 | JLabel labelid;
18 | JTextField textid;
19 | MyIconButton buttonid;
20 |
21 | JLabel labeldate;
22 | JTextField textdate;
23 | MyIconButton buttonupdateset;
24 |
25 | DefaultTableModel model;
26 | public static MyTabel table;
27 | private static Object[][] tableDatas;
28 | JScrollPane panelScroll;
29 |
30 | MyIconButton buttonupdatenow;
31 | JLabel info;
32 |
33 | public SettingPanelUpdateone() {
34 | initialize();
35 | addComponent();
36 | addListener();
37 | }
38 |
39 | private void initialize() {
40 | this.setBackground(Color.white);
41 | this.setLayout(new BorderLayout());
42 | }
43 |
44 | private void addComponent() {
45 | this.add(getCenterPanel(), BorderLayout.CENTER);
46 | this.add(getDownPanel(), BorderLayout.SOUTH);
47 | }
48 |
49 | private JPanel getCenterPanel() {
50 | JPanel panelCenter = new JPanel();
51 | panelCenter.setBackground(Color.white);
52 | panelCenter.setLayout(new GridLayout(2, 1));
53 |
54 | //设置Grid
55 | JPanel panelGridSetting = new JPanel();
56 | panelGridSetting.setBackground(Color.white);
57 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 20));
58 |
59 | //初始化组件
60 | labelid = new JLabel("输入id编号");
61 | labeldate = new JLabel("输入设置时间");
62 |
63 | textid = new JTextField();
64 | textdate = new JTextField();
65 |
66 |
67 | ImageIcon icon_id = new ImageIcon("src/resources/icon/findbyid.png");
68 | ImageIcon icon_id_enable = new ImageIcon("src/resources/icon/findbyidEnable.png");
69 | ImageIcon icon_id_disable = new ImageIcon("src/resources/icon/findbyidDisable.png");
70 |
71 | ImageIcon icon_now = new ImageIcon("src/resources/icon/now.png");
72 | ImageIcon icon_now_enable = new ImageIcon("src/resources/icon/nowEnable.png");
73 | ImageIcon icon_now_disable = new ImageIcon("src/resources/icon/nowDisable.png");
74 |
75 | ImageIcon icon_start = new ImageIcon("src/resources/icon/start.png");
76 | ImageIcon icon_start_enable = new ImageIcon("src/resources/icon/startEnable.png");
77 | ImageIcon icon_start_disable = new ImageIcon("src/resources/icon/startDisable.png");
78 |
79 | buttonid = new MyIconButton(icon_id, icon_id_enable, icon_id_disable, "id");
80 | buttonupdatenow = new MyIconButton(icon_now, icon_now_enable, icon_now_disable, "设置id");
81 | buttonupdateset = new MyIconButton(icon_start, icon_start_enable, icon_start_disable, "设置为当前日期");
82 |
83 | // 字体
84 | Font font = new Font("微软雅黑", 0, 13);
85 | labelid.setFont(font);
86 | textid.setFont(font);
87 |
88 | labeldate.setFont(font);
89 | textdate.setFont(font);
90 |
91 | // 大小
92 | labelid.setPreferredSize(new Dimension(100, 30));
93 | labeldate.setPreferredSize(new Dimension(100, 30));
94 | textid.setPreferredSize(new Dimension(250, 24));
95 | textdate.setPreferredSize(new Dimension(250, 24));
96 |
97 | panelGridSetting.add(labelid);
98 | panelGridSetting.add(textid);
99 | panelGridSetting.add(buttonid);
100 | panelGridSetting.add(labeldate);
101 | panelGridSetting.add(textdate);
102 | panelGridSetting.add(buttonupdatenow);
103 | panelGridSetting.add(buttonupdateset);
104 |
105 |
106 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
107 | table = new MyTabel(model);
108 | panelScroll = new JScrollPane(table) {
109 | public Dimension getPreferredSize() {
110 | return new Dimension(300, 200);
111 | }
112 | };
113 | panelScroll.setBackground(Color.white);
114 |
115 |
116 | panelCenter.add(panelGridSetting);
117 | panelCenter.add(panelScroll);
118 | return panelCenter;
119 | }
120 |
121 | private JPanel getDownPanel() {
122 | JPanel panelDown = new JPanel();
123 | info = new JLabel("输入添加内容");
124 | Font font = new Font("微软雅黑", 0, 12);
125 | panelDown.setFont(font);
126 | panelDown.add(info);
127 |
128 | return panelDown;
129 | }
130 |
131 | private void addListener() {
132 | buttonid.addActionListener(e -> {
133 | String id = textid.getText();
134 | if (id.equals("")) {
135 | info.setText("id不允许为空");
136 | JOptionPane.showMessageDialog(this, "id不允许为空");
137 | return;
138 | }
139 | inittableDateByid(id);
140 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
141 | table.setModel(model);
142 | table.Beautiful(false);
143 | info.setText("已更新");
144 | });
145 |
146 | buttonupdatenow.addActionListener(e -> {
147 | Date currentDate = new Date(System.currentTimeMillis());
148 | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
149 | String now = df.format(currentDate);
150 | textdate.setText(now);
151 | info.setText("已读取当前时间");
152 | JOptionPane.showMessageDialog(this, "已读取当前时间");
153 | });
154 |
155 | buttonupdateset.addActionListener(e -> {
156 | String id = textid.getText();
157 | if (id.equals("")) {
158 | info.setText("id不允许为空");
159 | JOptionPane.showMessageDialog(this, "id不允许为空");
160 | return;
161 | }
162 | Date date = Date.valueOf(textdate.getText());
163 | EleInfoDao.updateMtdate(date, id);
164 | info.setText("更新成功");
165 | buttonid.doClick();
166 | });
167 | }
168 |
169 | private static void inittableDateByid(String id) {
170 | EleInfo list = EleInfoDao.findbyeleid(id);
171 | Object[][] result = new Object[1][6];
172 | result[0][0] = list.getEleid();
173 | result[0][1] = list.getEletype();
174 | result[0][2] = list.getElecreatedate();
175 | result[0][3] = list.getElerange();
176 | result[0][4] = list.getEleaddress();
177 | result[0][5] = list.getElelastmtdate();
178 | tableDatas = result;
179 | }
180 |
181 | }
182 |
--------------------------------------------------------------------------------
/src/GUI/Panel/UserLoginPanel.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel;
2 |
3 | import Dao.EleRunInfoDao;
4 | import Dao.UserInfoDao;
5 | import Dao.UserLoginInfoDao;
6 | import GUI.AppMainWindow;
7 | import GUI.MyIconButton;
8 | import GUI.Panel.EleInfoPanelPackage.SettingPanelAddone;
9 | import GUI.Panel.EleInfoPanelPackage.SettingPanelDeleteone;
10 | import GUI.Panel.UserInfoPanelPackage.SettingPanelUpdateone;
11 |
12 | import javax.swing.*;
13 | import java.awt.*;
14 |
15 | public class UserLoginPanel extends JPanel {
16 | public static MyIconButton buttonlogin;
17 | public static MyIconButton buttonclear;
18 |
19 | public static JLabel labeluserid;
20 | public static JLabel labelpassword;
21 |
22 | public static JTextField textuserid;
23 | public static JPasswordField textpasswprd;
24 |
25 | public static JLabel bottominfo;
26 |
27 | public static boolean isadmin = false;
28 |
29 | /**
30 | * 构造
31 | */
32 | public UserLoginPanel() {
33 | super(true);
34 | initialize();
35 | addComponent();
36 | addListener();
37 | }
38 |
39 |
40 | /**
41 | * 初始化
42 | */
43 | private void initialize() {
44 | this.setBackground(Color.WHITE);
45 | this.setLayout(new BorderLayout());
46 | }
47 |
48 | /**
49 | * 添加组件
50 | */
51 | private void addComponent() {
52 | this.add(getUpPanel(), BorderLayout.NORTH);
53 | this.add(getCenterPanel(), BorderLayout.CENTER);
54 | this.add(getDownPanel(), BorderLayout.SOUTH);
55 | }
56 |
57 | /**
58 | * 上部面板
59 | *
60 | * @return
61 | */
62 | private JPanel getUpPanel() {
63 | JPanel panelUp = new JPanel();
64 | panelUp.setBackground(Color.WHITE);
65 | panelUp.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 5));
66 |
67 | JLabel labelTitle = new JLabel("登录");
68 |
69 | Font font = new Font("微软雅黑", 0, 27);
70 |
71 | labelTitle.setFont(font);
72 | labelTitle.setForeground(new Color(37, 174, 96));
73 | panelUp.add(labelTitle);
74 |
75 | return panelUp;
76 | }
77 |
78 | /**
79 | * 中部面板
80 | *
81 | * @return
82 | */
83 | private JPanel getCenterPanel() {
84 | JPanel panelcenter = new JPanel();
85 | panelcenter.setBackground(Color.white);
86 | panelcenter.setLayout(new GridLayout(2, 1));
87 |
88 | //设置grid
89 | JPanel panelGridSetting = new JPanel();
90 | panelGridSetting.setBackground(Color.white);
91 | panelGridSetting.setLayout(new FlowLayout(0, 25, 18));
92 |
93 | //new对象
94 | ImageIcon icon_clear = new ImageIcon("src/resources/icon/clear.png");
95 | ImageIcon icon_clear_enable = new ImageIcon("src/resources/icon/clearEnable.png");
96 | ImageIcon icon_clear_disable = new ImageIcon("src/resources/icon/clearDisable.png");
97 |
98 | ImageIcon icon_login = new ImageIcon("src/resources/icon/loginb.png");
99 | ImageIcon icon_login_enable = new ImageIcon("src/resources/icon/loginbEnable.png");
100 | ImageIcon icon_login_disable = new ImageIcon("src/resources/icon/loginbDisable.png");
101 |
102 |
103 | buttonlogin = new MyIconButton(icon_login, icon_login_enable, icon_login_disable, "Login");
104 | buttonclear = new MyIconButton(icon_clear, icon_clear_enable, icon_clear_disable, "Clear");
105 | labeluserid = new JLabel("UserID");
106 | labelpassword = new JLabel("PassWord");
107 | textuserid = new JTextField();
108 | textpasswprd = new JPasswordField();
109 |
110 | //设置尺寸
111 | Dimension SIZE = new Dimension(120, 30);
112 | labeluserid.setPreferredSize(SIZE);
113 | labelpassword.setPreferredSize(SIZE);
114 |
115 | SIZE = new Dimension(550, 24);
116 | textpasswprd.setPreferredSize(SIZE);
117 | textuserid.setPreferredSize(SIZE);
118 |
119 | // 字体
120 | Font font = new Font("微软雅黑", 0, 13);
121 | labeluserid.setFont(font);
122 | labelpassword.setFont(font);
123 | textpasswprd.setFont(font);
124 | textuserid.setFont(font);
125 |
126 | //add
127 | panelGridSetting.add(labeluserid);
128 | panelGridSetting.add(textuserid);
129 | panelGridSetting.add(labelpassword);
130 | panelGridSetting.add(textpasswprd);
131 | panelGridSetting.add(buttonlogin);
132 | panelGridSetting.add(buttonclear);
133 |
134 | panelcenter.add(panelGridSetting);
135 | return panelcenter;
136 | }
137 |
138 | /**
139 | * 底部面板
140 | *
141 | * @return
142 | */
143 | private JPanel getDownPanel() {
144 | JPanel paneldown = new JPanel();
145 | paneldown.setBackground(Color.white);
146 | paneldown.setLayout(new FlowLayout(2, 25, 15));
147 | bottominfo = new JLabel("欢迎进入电梯管理系统,请输入用户名与密码");
148 | paneldown.add(bottominfo);
149 | return paneldown;
150 | }
151 |
152 | private void addListener() {
153 | buttonlogin.addActionListener(e -> {
154 | String userid = textuserid.getText();
155 | String password = new String(textpasswprd.getPassword());
156 |
157 | if (userid.equals("")) {
158 | JOptionPane.showMessageDialog(this, "用户名不允许为空!");
159 | bottominfo.setText("用户名不允许为空");
160 | return;
161 | }
162 |
163 | String token = UserLoginInfoDao.findpwdbyid(userid);
164 | if (!token.equals(password)) {
165 | JOptionPane.showMessageDialog(this, "密码不正确!");
166 | bottominfo.setText("密码不正确");
167 | textpasswprd.setText("");
168 | return;
169 | }
170 |
171 | isadmin = UserInfoDao.isadmin(userid);
172 | System.out.println(isadmin);
173 |
174 | ToolBarPanel.setLogin(true);
175 |
176 | if (!isadmin) {
177 | SettingPanelAddone.setadmin();
178 | SettingPanelDeleteone.setadmin();
179 | GUI.Panel.UserInfoPanelPackage.SettingPanelAddone.setadmin();
180 | GUI.Panel.UserInfoPanelPackage.SettingPanelDeleteone.setadmin();
181 | SettingPanelUpdateone.setadmin();
182 | }
183 |
184 |
185 | bottominfo.setText("正在初始化中.....");
186 | EleRunInfoDao.initruntime();
187 | bottominfo.setText("初始化完成,进入系统......");
188 |
189 | AppMainWindow.mainPanelCenter.removeAll();
190 | AppMainWindow.mainPanelCenter.add(AppMainWindow.eleinfopanel, BorderLayout.CENTER);
191 | AppMainWindow.mainPanelCenter.updateUI();
192 |
193 | System.out.println("to EleInfo");
194 | });
195 |
196 | buttonclear.addActionListener(e -> {
197 | textuserid.setText("");
198 | textpasswprd.setText("");
199 | bottominfo.setText("已清空");
200 | });
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/src/Dao/UserInfoDao.java:
--------------------------------------------------------------------------------
1 | package Dao;
2 |
3 | import tables.UserInfo;
4 |
5 | import java.sql.ResultSet;
6 | import java.sql.SQLException;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | public class UserInfoDao {
11 |
12 | //转换
13 | private static UserInfo convertUserInfo(ResultSet rs) {
14 | UserInfo Info = new UserInfo();
15 | try {
16 | Info.setUserid(rs.getString("userid"));
17 | Info.setUsername(rs.getString("username"));
18 | Info.setUseradmin(rs.getBoolean("useradmin"));
19 | Info.setUserrange(rs.getString("userrange"));
20 | Info.setUseronline(rs.getBoolean("useronline"));
21 | } catch (SQLException e) {
22 | e.printStackTrace();
23 | }
24 | return Info;
25 | }
26 |
27 | //查询所有记录
28 | public static List allUserInfo() {
29 | try {
30 | List list = new ArrayList<>();
31 | String sql = "SELECT * FROM UserInfo";
32 | System.out.println("执行: " + sql);
33 | ResultSet rs = BaseDao.executeQuery(sql);
34 | while (rs.next()) {
35 | UserInfo info = convertUserInfo(rs);
36 | list.add(info);
37 | }
38 | rs.close();
39 | BaseDao.dbClose();
40 | return list;
41 | } catch (SQLException e) {
42 | e.printStackTrace();
43 | return null;
44 | }
45 | }
46 |
47 | //根据userid查询记录
48 | public static UserInfo findbyuserid(String userid) {
49 | try {
50 | UserInfo one = new UserInfo();
51 | String sql = "SELECT * FROM UserInfo WHERE userid = '" + userid + "'";
52 | System.out.println("执行: " + sql);
53 | ResultSet rs = BaseDao.executeQuery(sql);
54 | if (rs.next()) {
55 | one = convertUserInfo(rs);
56 | }
57 | rs.close();
58 | BaseDao.dbClose();
59 | return one;
60 | } catch (SQLException e) {
61 | e.printStackTrace();
62 | return null;
63 | }
64 | }
65 |
66 | //根据所处位置查询记录
67 | public static List findbyuserrange(String userrange) {
68 | try {
69 | List list = new ArrayList<>();
70 | String sql = "SELECT * FROM UserInfo WHERE userrange = '" + userrange + "'";
71 | System.out.println("执行: " + sql);
72 | ResultSet rs = BaseDao.executeQuery(sql);
73 | while (rs.next()) {
74 | UserInfo info = convertUserInfo(rs);
75 | list.add(info);
76 | }
77 | rs.close();
78 | BaseDao.dbClose();
79 | return list;
80 | } catch (SQLException e) {
81 | e.printStackTrace();
82 | return null;
83 | }
84 | }
85 |
86 | //根据所处位置以及是否在线
87 | public static List findbyRangeAndOnline(String userrange, boolean useronline) {
88 | try {
89 | List list = new ArrayList<>();
90 | String sql = "SELECT * FROM UserInfo WHERE userrange = '" + userrange + "' AND useronline = " + useronline;
91 | System.out.println("执行: " + sql);
92 | ResultSet rs = BaseDao.executeQuery(sql);
93 | while (rs.next()) {
94 | UserInfo info = convertUserInfo(rs);
95 | list.add(info);
96 | }
97 | rs.close();
98 | BaseDao.dbClose();
99 | return list;
100 | } catch (SQLException e) {
101 | e.printStackTrace();
102 | return null;
103 | }
104 | }
105 |
106 | //添加一名用户
107 | public static void addOneUser(UserInfo User, String pwd) {
108 | String sql = "insert into UserInfo values('"
109 | + User.getUserid() + "', '"
110 | + User.getUsername() + "', "
111 | + User.isUseradmin() + ", '"
112 | + User.getUserrange() + "', "
113 | + User.isUseronline() + ")";
114 | System.out.println("执行: " + sql);
115 | int r = BaseDao.executeUpdate(sql);
116 | sql = "insert into UserLoginInfo values('"
117 | + User.getUserid() + "', '"
118 | + pwd + "', "
119 | + User.isUseradmin() + ")";
120 | System.out.println("执行: " + sql);
121 | int n = BaseDao.executeUpdate(sql);
122 | if (n > 0) {
123 | System.out.println("成功添加" + r + "名用户");
124 | }
125 | BaseDao.dbClose();
126 | }
127 |
128 | //删除一名用户
129 | public static void deleteOneUser(String userid) {
130 | String sql = "delete from UserInfo where userid = '" + userid + "'";
131 | System.out.println("执行: " + sql);
132 | int r = BaseDao.executeUpdate(sql);
133 | sql = "delete from UserLoginInfo where userid = '" + userid + "'";
134 | System.out.println("执行: " + sql);
135 | int n = BaseDao.executeUpdate(sql);
136 | if (r > 0 || n > 0)
137 | System.out.println("成功删除" + r + "名用户");
138 | BaseDao.dbClose();
139 | }
140 |
141 | //更改一名用户的状态
142 | public static void updateOneuserOnlineByuserid(String userid, boolean isonline) {
143 | String sql = "UPDATE UserInfo SET useronline = " + isonline + " WHERE userid = '" + userid + "'";
144 | System.out.println("执行: " + sql);
145 | int r = BaseDao.executeUpdate(sql);
146 | if (r > 0)
147 | System.out.println("成功更新" + r + "名用户状态");
148 | BaseDao.dbClose();
149 | }
150 |
151 | //查找名字类似的维修人员
152 | public static List searchUsername(String name) {
153 | try {
154 | List list = new ArrayList<>();
155 | String sql = "SELECT * FROM userinfo WHERE username LIKE '%" + name + "%'";
156 | System.out.println("执行: " + sql);
157 | ResultSet rs = BaseDao.executeQuery(sql);
158 | while (rs.next()) {
159 | UserInfo info = convertUserInfo(rs);
160 | list.add(info);
161 | }
162 | rs.close();
163 | BaseDao.dbClose();
164 | return list;
165 | } catch (SQLException e) {
166 | e.printStackTrace();
167 | return null;
168 | }
169 | }
170 |
171 | //验证用户是否为管理员
172 | public static boolean isadmin(String userid) {
173 | try {
174 | boolean bool = false;
175 | String sql = "SELECT useradmin FROM UserInfo WHERE userid = '" + userid + "'";
176 | System.out.println("执行: " + sql);
177 | ResultSet rs = BaseDao.executeQuery(sql);
178 | if (rs.next()) {
179 | bool = rs.getBoolean("useradmin");
180 | }
181 | rs.close();
182 | BaseDao.dbClose();
183 | return bool;
184 | } catch (SQLException e) {
185 | e.printStackTrace();
186 | return false;
187 | }
188 | }
189 |
190 | //升级用户为管理员
191 | public static void updateadmin(String id) {
192 | String sql = "update UserInfo set useradmin = " + true + " WHERE userid = '" + id + "'";
193 | System.out.println("执行: " + sql);
194 | int r = BaseDao.executeUpdate(sql);
195 | if (r > 0)
196 | System.out.println("成功升级" + r + "名用户为管理员");
197 | BaseDao.dbClose();
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/src/GUI/Panel/UserInfoPanelPackage/SettingPanelAddone.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.UserInfoPanelPackage;
2 |
3 | import Dao.UserInfoDao;
4 | import GUI.MyIconButton;
5 | import GUI.Panel.UserInfoPanel;
6 | import com.sun.org.apache.xpath.internal.operations.Bool;
7 | import tables.UserInfo;
8 |
9 | import javax.swing.*;
10 | import java.awt.*;
11 |
12 | public class SettingPanelAddone extends JPanel {
13 | JLabel labelid;
14 | JLabel labelname;
15 | JLabel labeladmin;
16 | JLabel labelrange;
17 | JLabel labelonline;
18 | JLabel labelpassword;
19 |
20 | JLabel info;
21 |
22 | JTextField textid;
23 | JTextField textname;
24 | JTextField textrange;
25 | JPasswordField textpassword;
26 |
27 | JCheckBox boxadmin;
28 | JCheckBox boxonline;
29 |
30 | MyIconButton buttonclear;
31 | static MyIconButton buttonadd;
32 |
33 | public SettingPanelAddone() {
34 | initialize();
35 | addComponent();
36 | addListener();
37 | }
38 |
39 | private void initialize() {
40 | this.setBackground(Color.white);
41 | this.setLayout(new BorderLayout());
42 | }
43 |
44 | private void addComponent() {
45 | this.add(getCenterPanel(), BorderLayout.CENTER);
46 | this.add(getDownPanel(), BorderLayout.SOUTH);
47 | }
48 |
49 | private JPanel getCenterPanel() {
50 | JPanel panelCenter = new JPanel();
51 | panelCenter.setBackground(Color.white);
52 | panelCenter.setLayout(new GridLayout(0, 1));
53 |
54 | JPanel panelGridSetting = new JPanel();
55 | panelGridSetting.setBackground(Color.white);
56 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 18));
57 |
58 | labelid = new JLabel("编号");
59 | labelname = new JLabel("姓名");
60 | labeladmin = new JLabel("管理员");
61 | labelrange = new JLabel("区域");
62 | labelonline = new JLabel("在岗");
63 | labelpassword = new JLabel("密码");
64 |
65 | textid = new JTextField();
66 | textname = new JTextField();
67 | textrange = new JTextField();
68 | textpassword = new JPasswordField();
69 |
70 | boxadmin = new JCheckBox("是");
71 | boxonline = new JCheckBox("是");
72 |
73 | // 字体
74 | Font font = new Font("微软雅黑", 0, 13);
75 | labelid.setFont(font);
76 | labelname.setFont(font);
77 | labeladmin.setFont(font);
78 | labelrange.setFont(font);
79 | labelonline.setFont(font);
80 | labelpassword = new JLabel("密码");
81 | textid.setFont(font);
82 | textname.setFont(font);
83 | textrange.setFont(font);
84 | textpassword = new JPasswordField();
85 | boxadmin.setFont(font);
86 | boxonline.setFont(font);
87 |
88 | // 大小
89 | Dimension SIZE = new Dimension(78, 30);
90 | labelid.setPreferredSize(SIZE);
91 | labelname.setPreferredSize(SIZE);
92 | labeladmin.setPreferredSize(SIZE);
93 | labelrange.setPreferredSize(SIZE);
94 | labelonline.setPreferredSize(SIZE);
95 | labelpassword.setPreferredSize(SIZE);
96 |
97 | SIZE = new Dimension(400, 24);
98 | textid.setPreferredSize(SIZE);
99 | textname.setPreferredSize(SIZE);
100 | textrange.setPreferredSize(SIZE);
101 | textpassword.setPreferredSize(SIZE);
102 | boxadmin.setPreferredSize(SIZE);
103 | boxonline.setPreferredSize(SIZE);
104 |
105 | boxadmin.setBackground(Color.white);
106 | boxonline.setBackground(Color.white);
107 |
108 |
109 | panelGridSetting.add(labelid);
110 | panelGridSetting.add(textid);
111 | panelGridSetting.add(labelname);
112 | panelGridSetting.add(textname);
113 | panelGridSetting.add(labeladmin);
114 | panelGridSetting.add(boxadmin);
115 | panelGridSetting.add(labelrange);
116 | panelGridSetting.add(textrange);
117 | panelGridSetting.add(labelonline);
118 | panelGridSetting.add(boxonline);
119 | panelGridSetting.add(labelpassword);
120 | panelGridSetting.add(textpassword);
121 | panelCenter.add(panelGridSetting);
122 | return panelCenter;
123 | }
124 |
125 | private JPanel getDownPanel() {
126 | JPanel panelDown = new JPanel();
127 | panelDown.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
128 | panelDown.setPreferredSize(new Dimension(0, 70));
129 |
130 | JPanel panelbutton = new JPanel();
131 | panelbutton.setBackground(Color.white);
132 | panelbutton.setLayout(new FlowLayout(FlowLayout.RIGHT, 50, 0));
133 | panelbutton.setPreferredSize(new Dimension(630, 50));
134 |
135 | ImageIcon icon_clear = new ImageIcon("src/resources/icon/clear.png");
136 | ImageIcon icon_clear_enable = new ImageIcon("src/resources/icon/clearEnable.png");
137 | ImageIcon icon_clear_disable = new ImageIcon("src/resources/icon/clearDisable.png");
138 |
139 | ImageIcon icon_start = new ImageIcon("src/resources/icon/start.png");
140 | ImageIcon icon_start_enable = new ImageIcon("src/resources/icon/startEnable.png");
141 | ImageIcon icon_start_disable = new ImageIcon("src/resources/icon/startDisable.png");
142 |
143 |
144 | buttonclear = new MyIconButton(icon_clear, icon_clear_enable, icon_clear_disable, "clear");
145 | buttonadd = new MyIconButton(icon_start, icon_start_enable, icon_start_disable, "add");
146 | panelbutton.add(buttonclear);
147 | panelbutton.add(buttonadd);
148 |
149 | info = new JLabel("输入添加内容");
150 | Font font = new Font("微软雅黑", 0, 12);
151 | panelDown.setFont(font);
152 |
153 | panelDown.add(panelbutton);
154 | panelDown.add(info);
155 |
156 | return panelDown;
157 | }
158 |
159 | private void addListener() {
160 | buttonclear.addActionListener(e -> {
161 | textid.setText("");
162 | textname.setText("");
163 | textrange.setText("");
164 | textpassword.setText("");
165 | boxonline.setSelected(false);
166 | boxadmin.setSelected(false);
167 |
168 | info.setText("已清空");
169 | });
170 |
171 | buttonadd.addActionListener(e -> {
172 | String id = textid.getText();
173 | String range = textrange.getText();
174 | String name = textname.getText();
175 | String password = new String(textpassword.getPassword());
176 | Boolean admin = boxadmin.isSelected();
177 | Boolean online = boxonline.isSelected();
178 |
179 | if (id.equals("")) {
180 | info.setText("ID不允许为空");
181 | JOptionPane.showMessageDialog(this, "ID不允许为空");
182 | return;
183 | }
184 | if (range.equals("")) {
185 | info.setText("range不允许为空");
186 | JOptionPane.showMessageDialog(this, "range不允许为空");
187 |
188 | return;
189 | }
190 | if (name.equals("")) {
191 | info.setText("name不允许为空");
192 | JOptionPane.showMessageDialog(this, "name不允许为空");
193 | return;
194 | }
195 | if (password.equals("")) {
196 | info.setText("password不允许为空");
197 | JOptionPane.showMessageDialog(this, "password不允许为空");
198 | return;
199 | }
200 |
201 | UserInfo user = new UserInfo();
202 | user.setUserid(id);
203 | user.setUsername(name);
204 | user.setUserrange(range);
205 | user.setUseradmin(admin);
206 | user.setUseronline(online);
207 |
208 | UserInfoDao.addOneUser(user, password);
209 |
210 | info.setText("已成功添加一个用户记录!");
211 |
212 | UserInfoPanel.settingPanelMain.removeAll();
213 | UserInfoPanel.settingPanelMain.add(new SettingPanelShowall());
214 | UserInfoPanel.settingPanelMain.updateUI();
215 | });
216 | }
217 |
218 | public static void setadmin() {
219 | buttonadd.setEnabled(false);
220 | }
221 |
222 | }
223 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleRunInfoPanel.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel;
2 |
3 | import GUI.AppMainWindow;
4 | import GUI.Panel.EleRunInfoPanelPackage.*;
5 |
6 | import javax.swing.*;
7 | import java.awt.*;
8 | import java.awt.event.MouseEvent;
9 | import java.awt.event.MouseListener;
10 |
11 | public class EleRunInfoPanel extends JPanel {
12 | //RunInfo跳转
13 | public static JPanel settingpanelshowall;
14 | public static JPanel settingpanelshowerrormsg;
15 | public static JPanel settingpanelrunningtime;
16 |
17 | public static JPanel settingPanelMain;
18 |
19 | //子菜单按钮选项
20 | public static JPanel panelshowall;
21 | public static JPanel panelshowerrormsg;
22 | public static JPanel panelrunningtime;
23 |
24 | //子菜单标签
25 | public static JLabel labelshowall;
26 | public static JLabel labelshowerrormsg;
27 | public static JLabel labelrunningtime;
28 |
29 | /**
30 | * 构造
31 | */
32 | public EleRunInfoPanel() {
33 | initialize();
34 | addComponent();
35 | addListener();
36 | }
37 |
38 | /**
39 | * 初始化
40 | */
41 | private void initialize() {
42 | this.setBackground(Color.white);
43 | this.setLayout(new BorderLayout());
44 | settingpanelshowall = new SettingPanelShowall();
45 | settingpanelshowerrormsg = new SettingpanelShowErrmsg();
46 | settingpanelrunningtime = new SettingPanelRunningTime();
47 | }
48 |
49 | private void addComponent() {
50 | this.add(getUpPanel(), BorderLayout.NORTH);
51 | this.add(getCenterPanel(), BorderLayout.CENTER);
52 | }
53 |
54 | private JPanel getUpPanel() {
55 | JPanel panelUp = new JPanel();
56 | panelUp.setBackground(Color.white);
57 | panelUp.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 5));
58 |
59 | JLabel labeltitle = new JLabel("电梯运行状况");
60 |
61 | Font font = new Font("微软雅黑", 0, 27);
62 | labeltitle.setFont(font);
63 | labeltitle.setForeground(new Color(37, 174, 96));
64 | panelUp.add(labeltitle);
65 |
66 | return panelUp;
67 | }
68 |
69 | private JPanel getCenterPanel() {
70 | //面板
71 | JPanel panelCenter = new JPanel();
72 | panelCenter.setBackground(Color.white);
73 | panelCenter.setLayout(new BorderLayout());
74 |
75 | //二级菜单panel
76 | JPanel panellist = new JPanel();
77 | Dimension SIZE = new Dimension(200, 636);
78 | panellist.setPreferredSize(SIZE);
79 | panellist.setBackground(new Color(62, 62, 62));
80 | panellist.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
81 |
82 | //new子选项
83 | panelshowall = new JPanel();
84 | panelshowall.setBackground(new Color(69, 186, 121));
85 | panelshowall.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
86 | SIZE = new Dimension(200, 48);
87 | panelshowall.setPreferredSize(SIZE);
88 |
89 | panelshowerrormsg = new JPanel();
90 | panelshowerrormsg.setBackground(new Color(37, 174, 96));
91 | panelshowerrormsg.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
92 | SIZE = new Dimension(200, 48);
93 | panelshowerrormsg.setPreferredSize(SIZE);
94 |
95 | panelrunningtime = new JPanel();
96 | panelrunningtime.setBackground(new Color(37, 174, 96));
97 | panelrunningtime.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
98 | SIZE = new Dimension(200, 48);
99 | panelrunningtime.setPreferredSize(SIZE);
100 |
101 | //Label添加标签
102 | labelshowall = new JLabel("显示所有运行信息");
103 | labelshowerrormsg = new JLabel("查询错误运行信息");
104 | labelrunningtime = new JLabel("查看运行时间过长电梯");
105 | //设置字体
106 | Font font = new Font("微软雅黑", 0, 15);
107 | labelshowall.setFont(font);
108 | labelshowerrormsg.setFont(font);
109 | labelrunningtime.setFont(font);
110 | //设置背景透明
111 | labelshowall.setForeground(Color.white);
112 | labelshowerrormsg.setForeground(Color.white);
113 | labelrunningtime.setForeground(Color.white);
114 | //标签显示文字
115 | panelshowall.add(labelshowall);
116 | panelshowerrormsg.add(labelshowerrormsg);
117 | panelrunningtime.add(labelrunningtime);
118 |
119 | //添加菜单
120 | panellist.add(panelshowall);
121 | panellist.add(panelshowerrormsg);
122 | panellist.add(panelrunningtime);
123 |
124 | //设置panel
125 | settingPanelMain = new JPanel();
126 | settingPanelMain.setBackground(Color.white);
127 | settingPanelMain.setLayout(new BorderLayout());
128 | settingPanelMain.add(settingpanelshowall, BorderLayout.CENTER);
129 |
130 | panelCenter.add(panellist, BorderLayout.WEST);
131 | panelCenter.add(settingPanelMain, BorderLayout.CENTER);
132 |
133 | return panelCenter;
134 | }
135 |
136 | private void addListener() {
137 | panelshowall.addMouseListener(new MouseListener() {
138 | @Override
139 | public void mouseClicked(MouseEvent e) {
140 | panelshowall.setBackground(new Color(37, 174, 96));
141 | panelshowerrormsg.setBackground(new Color(37, 174, 96));
142 | panelrunningtime.setBackground(new Color(37, 174, 96));
143 |
144 | panelshowall.setBackground(new Color(69, 186, 121));
145 |
146 | EleRunInfoPanel.settingPanelMain.removeAll();
147 | EleRunInfoPanel.settingPanelMain.add(settingpanelshowall, BorderLayout.CENTER);
148 | AppMainWindow.mainPanelCenter.updateUI();
149 | }
150 |
151 | @Override
152 | public void mousePressed(MouseEvent e) {
153 |
154 | }
155 |
156 | @Override
157 | public void mouseReleased(MouseEvent e) {
158 |
159 | }
160 |
161 | @Override
162 | public void mouseEntered(MouseEvent e) {
163 |
164 | }
165 |
166 | @Override
167 | public void mouseExited(MouseEvent e) {
168 |
169 | }
170 | });
171 |
172 |
173 | panelshowerrormsg.addMouseListener(new MouseListener() {
174 | @Override
175 | public void mouseClicked(MouseEvent e) {
176 | panelshowall.setBackground(new Color(37, 174, 96));
177 | panelshowerrormsg.setBackground(new Color(37, 174, 96));
178 | panelrunningtime.setBackground(new Color(37, 174, 96));
179 |
180 | panelshowerrormsg.setBackground(new Color(69, 186, 121));
181 |
182 | EleRunInfoPanel.settingPanelMain.removeAll();
183 | EleRunInfoPanel.settingPanelMain.add(settingpanelshowerrormsg, BorderLayout.CENTER);
184 | AppMainWindow.mainPanelCenter.updateUI();
185 | }
186 |
187 | @Override
188 | public void mousePressed(MouseEvent e) {
189 |
190 | }
191 |
192 | @Override
193 | public void mouseReleased(MouseEvent e) {
194 |
195 | }
196 |
197 | @Override
198 | public void mouseEntered(MouseEvent e) {
199 |
200 | }
201 |
202 | @Override
203 | public void mouseExited(MouseEvent e) {
204 |
205 | }
206 | });
207 |
208 | panelrunningtime.addMouseListener(new MouseListener() {
209 | @Override
210 | public void mouseClicked(MouseEvent e) {
211 | panelshowall.setBackground(new Color(37, 174, 96));
212 | panelshowerrormsg.setBackground(new Color(37, 174, 96));
213 | panelrunningtime.setBackground(new Color(37, 174, 96));
214 |
215 | panelrunningtime.setBackground(new Color(69, 186, 121));
216 |
217 | EleRunInfoPanel.settingPanelMain.removeAll();
218 | EleRunInfoPanel.settingPanelMain.add(settingpanelrunningtime, BorderLayout.CENTER);
219 | AppMainWindow.mainPanelCenter.updateUI();
220 | }
221 |
222 | @Override
223 | public void mousePressed(MouseEvent e) {
224 |
225 | }
226 |
227 | @Override
228 | public void mouseReleased(MouseEvent e) {
229 |
230 | }
231 |
232 | @Override
233 | public void mouseEntered(MouseEvent e) {
234 |
235 | }
236 |
237 | @Override
238 | public void mouseExited(MouseEvent e) {
239 |
240 | }
241 | });
242 | }
243 | }
244 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleInfoPanelPackage/SettingPanelAddone.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleInfoPanelPackage;
2 |
3 | import Dao.EleInfoDao;
4 | import GUI.MyIconButton;
5 |
6 | import javax.swing.*;
7 | import java.awt.*;
8 | import java.sql.Date;
9 |
10 | import GUI.Panel.EleInfoPanel;
11 | import System.InputCheck;
12 | import tables.EleInfo;
13 |
14 | public class SettingPanelAddone extends JPanel {
15 | JLabel labelid;
16 | JLabel labeltype;
17 | JLabel labelcreatedate;
18 | JLabel labelrange;
19 | JLabel labeladdress;
20 | JLabel labelmtdate;
21 |
22 | JLabel info;
23 |
24 | JTextField textid;
25 | JTextField texttype;
26 | JTextField textcreatedate;
27 | JTextField textrange;
28 | JTextField textaddress;
29 | JTextField textmtdate;
30 |
31 | MyIconButton buttonclear;
32 | static MyIconButton buttonadd;
33 |
34 | public SettingPanelAddone() {
35 | initialize();
36 | addComponent();
37 | addListener();
38 | }
39 |
40 | private void initialize() {
41 | this.setBackground(Color.white);
42 | this.setLayout(new BorderLayout());
43 | }
44 |
45 | private void addComponent() {
46 | this.add(getCenterPanel(), BorderLayout.CENTER);
47 | this.add(getDownPanel(), BorderLayout.SOUTH);
48 | }
49 |
50 | private JPanel getCenterPanel() {
51 | JPanel panelCenter = new JPanel();
52 | panelCenter.setBackground(Color.white);
53 | panelCenter.setLayout(new GridLayout(0, 1));
54 |
55 | JPanel panelGridSetting = new JPanel();
56 | panelGridSetting.setBackground(Color.white);
57 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 18));
58 |
59 | labelid = new JLabel("编号");
60 | labeltype = new JLabel("型号");
61 | labelcreatedate = new JLabel("创建日期");
62 | labeladdress = new JLabel("地址");
63 | labelrange = new JLabel("区域");
64 | labelmtdate = new JLabel("最近维修日期");
65 |
66 | textid = new JTextField();
67 | texttype = new JTextField();
68 | textcreatedate = new JTextField();
69 | textaddress = new JTextField();
70 | textrange = new JTextField();
71 | textmtdate = new JTextField();
72 |
73 | // 字体
74 | Font font = new Font("微软雅黑", 0, 13);
75 | labelid.setFont(font);
76 | labeltype.setFont(font);
77 | labelcreatedate.setFont(font);
78 | labeladdress.setFont(font);
79 | labelrange.setFont(font);
80 | labelmtdate.setFont(font);
81 | textid.setFont(font);
82 | texttype.setFont(font);
83 | textcreatedate.setFont(font);
84 | textaddress.setFont(font);
85 | textrange.setFont(font);
86 | textmtdate.setFont(font);
87 |
88 | // 大小
89 | Dimension SIZE = new Dimension(78, 30);
90 | labelid.setPreferredSize(SIZE);
91 | labeltype.setPreferredSize(SIZE);
92 | labelcreatedate.setPreferredSize(SIZE);
93 | labeladdress.setPreferredSize(SIZE);
94 | labelrange.setPreferredSize(SIZE);
95 | labelmtdate.setPreferredSize(SIZE);
96 |
97 | SIZE = new Dimension(400, 24);
98 | textid.setPreferredSize(SIZE);
99 | texttype.setPreferredSize(SIZE);
100 | textcreatedate.setPreferredSize(SIZE);
101 | textaddress.setPreferredSize(SIZE);
102 | textrange.setPreferredSize(SIZE);
103 | textmtdate.setPreferredSize(SIZE);
104 |
105 | panelGridSetting.add(labelid);
106 | panelGridSetting.add(textid);
107 | panelGridSetting.add(labeltype);
108 | panelGridSetting.add(texttype);
109 | panelGridSetting.add(labelcreatedate);
110 | panelGridSetting.add(textcreatedate);
111 | panelGridSetting.add(labeladdress);
112 | panelGridSetting.add(textaddress);
113 | panelGridSetting.add(labelrange);
114 | panelGridSetting.add(textrange);
115 | panelGridSetting.add(labelmtdate);
116 | panelGridSetting.add(textmtdate);
117 |
118 | panelCenter.add(panelGridSetting);
119 | return panelCenter;
120 | }
121 |
122 |
123 | private JPanel getDownPanel() {
124 | JPanel panelDown = new JPanel();
125 | panelDown.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
126 | panelDown.setPreferredSize(new Dimension(0, 70));
127 |
128 | JPanel panelbutton = new JPanel();
129 | panelbutton.setBackground(Color.white);
130 | panelbutton.setLayout(new FlowLayout(FlowLayout.RIGHT, 50, 0));
131 | panelbutton.setPreferredSize(new Dimension(630, 50));
132 |
133 | ImageIcon icon_clear = new ImageIcon("src/resources/icon/clear.png");
134 | ImageIcon icon_clear_enable = new ImageIcon("src/resources/icon/clearEnable.png");
135 | ImageIcon icon_clear_disable = new ImageIcon("src/resources/icon/clearDisable.png");
136 |
137 | ImageIcon icon_start = new ImageIcon("src/resources/icon/start.png");
138 | ImageIcon icon_start_enable = new ImageIcon("src/resources/icon/startEnable.png");
139 | ImageIcon icon_start_disable = new ImageIcon("src/resources/icon/startDisable.png");
140 |
141 |
142 | buttonclear = new MyIconButton(icon_clear, icon_clear_enable, icon_clear_disable, "clear");
143 | buttonadd = new MyIconButton(icon_start, icon_start_enable, icon_start_disable, "add");
144 | panelbutton.add(buttonclear);
145 | panelbutton.add(buttonadd);
146 |
147 | info = new JLabel("输入添加内容");
148 | Font font = new Font("微软雅黑", 0, 12);
149 | panelDown.setFont(font);
150 |
151 | panelDown.add(panelbutton);
152 | panelDown.add(info);
153 |
154 | return panelDown;
155 | }
156 |
157 | private void addListener() {
158 | buttonclear.addActionListener(e -> {
159 | textid.setText("");
160 | texttype.setText("");
161 | textcreatedate.setText("");
162 | textaddress.setText("");
163 | textrange.setText("");
164 | textmtdate.setText("");
165 | info.setText("已清空");
166 | });
167 |
168 | buttonadd.addActionListener(e -> {
169 | String id = textid.getText();
170 | String type = texttype.getText();
171 | String createdate = textcreatedate.getText();
172 | String address = textaddress.getText();
173 | String range = textrange.getText();
174 | String mtdate = textmtdate.getText();
175 |
176 | if (id.equals("")) {
177 | info.setText("id不为空");
178 | JOptionPane.showMessageDialog(this, "id不为空!");
179 | return;
180 | }
181 | if (type.equals("")) {
182 | info.setText("type不为空");
183 | JOptionPane.showMessageDialog(this, "type不为空!");
184 | return;
185 | }
186 | if (createdate.equals("")) {
187 | info.setText("createdate不为空");
188 | JOptionPane.showMessageDialog(this, "createdate不为空!");
189 | return;
190 | }
191 | if (address.equals("")) {
192 | info.setText("address不为空");
193 | JOptionPane.showMessageDialog(this, "address不为空!");
194 | return;
195 | }
196 | if (range.equals("")) {
197 | info.setText("range不为空");
198 | JOptionPane.showMessageDialog(this, "range不为空!");
199 | return;
200 | }
201 | if (mtdate.equals("")) {
202 | info.setText("mtdate不为空");
203 | JOptionPane.showMessageDialog(this, "mtdate不为空!");
204 | return;
205 | }
206 | if (!InputCheck.datecheck(createdate)) {
207 | info.setText("创建日期不合法(yyyy-mm-dd)");
208 | JOptionPane.showMessageDialog(this, "创建日期不合法(yyyy-mm-dd)!");
209 | return;
210 | }
211 | if (!InputCheck.datecheck(mtdate)) {
212 | info.setText("最近维修日期不合法(yyyy-mm-dd)");
213 | JOptionPane.showMessageDialog(this, "最近维修日期不合法(yyyy-mm-dd)");
214 |
215 | return;
216 | }
217 |
218 | EleInfo ele = new EleInfo();
219 | ele.setEleid(id);
220 | ele.setEletype(type);
221 | ele.setElecreatedate(Date.valueOf(createdate));
222 | ele.setElerange(range);
223 | ele.setEleaddress(address);
224 | ele.setElelastmtdate(Date.valueOf(mtdate));
225 | EleInfoDao.addOneEle(ele);
226 |
227 | info.setText("已成功添加一个电梯记录!");
228 |
229 | EleInfoPanel.settingPanelMain.removeAll();
230 | EleInfoPanel.settingPanelMain.add(new SettingPanelShowall());
231 | EleInfoPanel.settingPanelMain.updateUI();
232 |
233 | });
234 | }
235 |
236 | public static void setadmin() {
237 | buttonadd.setEnabled(false);
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/src/GUI/Panel/UserInfoPanelPackage/SettingPanelShowById.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.UserInfoPanelPackage;
2 |
3 | import Dao.UserInfoDao;
4 | import GUI.MyIconButton;
5 | import GUI.MyTabel;
6 | import tables.UserInfo;
7 |
8 | import javax.swing.*;
9 | import javax.swing.table.DefaultTableModel;
10 | import java.awt.*;
11 | import java.util.List;
12 |
13 | public class SettingPanelShowById extends JPanel {
14 | JLabel labelid;
15 | JLabel labelrange;
16 | JLabel labelonline;
17 |
18 | JTextField textid;
19 | JTextField textrange;
20 | JCheckBox boxonline;
21 |
22 | MyIconButton buttonid;
23 | MyIconButton buttonrange;
24 | MyIconButton buttonrangeandonline;
25 |
26 | JLabel info;
27 |
28 | DefaultTableModel model;
29 | public static MyTabel table;
30 | private static Object[][] tableDatas;
31 | JScrollPane panelScroll;
32 |
33 | public SettingPanelShowById() {
34 | initialize();
35 | tableDatas = new Object[1][6];
36 | addComponent();
37 | addListener();
38 | }
39 |
40 | private void initialize() {
41 | this.setBackground(Color.white);
42 | this.setLayout(new BorderLayout());
43 | }
44 |
45 | private void addComponent() {
46 | this.add(getCenterPanel(), BorderLayout.CENTER);
47 | this.add(getDownPanel(), BorderLayout.SOUTH);
48 | }
49 |
50 | private JPanel getCenterPanel() {
51 | JPanel panelCenter = new JPanel();
52 | panelCenter.setBackground(Color.white);
53 | panelCenter.setLayout(new GridLayout(2, 1));
54 |
55 |
56 | //设置Grid
57 | JPanel panelGridSetting = new JPanel();
58 | panelGridSetting.setBackground(Color.white);
59 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 30));
60 |
61 | //初始化组件
62 | labelid = new JLabel("输入用户id编号");
63 | labelrange = new JLabel("输入用户区域");
64 | labelonline = new JLabel("用户是否在线");
65 |
66 | textid = new JTextField();
67 | textrange = new JTextField();
68 | boxonline = new JCheckBox("在岗");
69 |
70 | boxonline.setBackground(Color.white);
71 |
72 | ImageIcon icon_id = new ImageIcon("src/resources/icon/findbyid.png");
73 | ImageIcon icon_id_enable = new ImageIcon("src/resources/icon/findbyidEnable.png");
74 | ImageIcon icon_id_disable = new ImageIcon("src/resources/icon/findbyidDisable.png");
75 |
76 | ImageIcon icon_range = new ImageIcon("src/resources/icon/findbyrange.png");
77 | ImageIcon icon_range_enable = new ImageIcon("src/resources/icon/findbyrangeEnable.png");
78 | ImageIcon icon_range_disable = new ImageIcon("src/resources/icon/findbyrangeDisable.png");
79 |
80 | ImageIcon icon_all = new ImageIcon("src/resources/icon/rangeandonline.png");
81 | ImageIcon icon_all_enable = new ImageIcon("src/resources/icon/rangeandonlineEnable.png");
82 | ImageIcon icon_all_disable = new ImageIcon("src/resources/icon/rangeandonlineDisable.png");
83 |
84 | buttonid = new MyIconButton(icon_id, icon_id_enable, icon_id_disable, "id");
85 | buttonrange = new MyIconButton(icon_range, icon_range_enable, icon_range_disable, "range");
86 | buttonrangeandonline = new MyIconButton(icon_all, icon_all_enable, icon_all_disable, "range");
87 |
88 | // 字体
89 | Font font = new Font("微软雅黑", 0, 13);
90 | labelid.setFont(font);
91 | labelrange.setFont(font);
92 | labelonline.setFont(font);
93 | textid.setFont(font);
94 | textrange.setFont(font);
95 | boxonline.setFont(font);
96 |
97 | // 大小
98 | Dimension SIZE = new Dimension(100, 30);
99 | labelid.setPreferredSize(SIZE);
100 | labelrange.setPreferredSize(SIZE);
101 | labelonline.setPreferredSize(SIZE);
102 |
103 | SIZE = new Dimension(250, 24);
104 | textid.setPreferredSize(SIZE);
105 | textrange.setPreferredSize(SIZE);
106 | boxonline.setPreferredSize(SIZE);
107 |
108 | panelGridSetting.add(labelid);
109 | panelGridSetting.add(textid);
110 | panelGridSetting.add(buttonid);
111 | panelGridSetting.add(labelrange);
112 | panelGridSetting.add(textrange);
113 | panelGridSetting.add(buttonrange);
114 | panelGridSetting.add(labelonline);
115 | panelGridSetting.add(boxonline);
116 | panelGridSetting.add(buttonrangeandonline);
117 |
118 |
119 | //表格设置
120 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
121 | table = new MyTabel(model);
122 | table.Beautiful(false);
123 |
124 | //设置滚动条
125 | panelScroll = new JScrollPane(table) {
126 | public Dimension getPreferredSize() {
127 | return new Dimension(300, 60);
128 | }
129 | };
130 | panelScroll.setBackground(Color.white);
131 |
132 |
133 | panelCenter.add(panelGridSetting);
134 | panelCenter.add(panelScroll);
135 |
136 | return panelCenter;
137 | }
138 |
139 | private JPanel getDownPanel() {
140 | JPanel panelDown = new JPanel();
141 | info = new JLabel("输入查询内容");
142 |
143 | Font font = new Font("微软雅黑", 0, 12);
144 | panelDown.setFont(font);
145 | panelDown.add(info);
146 |
147 | return panelDown;
148 | }
149 |
150 | private void addListener() {
151 | buttonid.addActionListener(e -> {
152 | String id = textid.getText();
153 | if (id.equals("")) {
154 | info.setText("ID不允许为空");
155 | JOptionPane.showMessageDialog(this, "ID不允许为空");
156 | return;
157 | }
158 |
159 | inittabledatabyid(id);
160 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
161 | table.setModel(model);
162 | table.Beautiful(false);
163 | info.setText("已更新");
164 | });
165 |
166 | buttonrange.addActionListener(e -> {
167 | String range = textrange.getText();
168 | if (range.equals("")) {
169 | info.setText("range不允许为空");
170 | JOptionPane.showMessageDialog(this, "range不允许为空");
171 | return;
172 | }
173 |
174 | inittabledatabyrange(range);
175 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
176 | table.setModel(model);
177 | table.Beautiful(false);
178 | info.setText("已更新");
179 |
180 | });
181 |
182 | buttonrangeandonline.addActionListener(e -> {
183 | String range = textrange.getText();
184 | boolean online = boxonline.isSelected();
185 | if (range.equals("")) {
186 | info.setText("range不允许为空");
187 | JOptionPane.showMessageDialog(this, "range不允许为空");
188 |
189 | return;
190 | }
191 |
192 | inittabledatabyidandrange(range, online);
193 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "姓名", "管理员", "所在区域", "在岗状态", ""});
194 | table.setModel(model);
195 | table.Beautiful(false);
196 | info.setText("已更新");
197 | });
198 | }
199 |
200 |
201 | public static void inittabledatabyid(String id) {
202 | UserInfo list = UserInfoDao.findbyuserid(id);
203 | Object[][] result = new Object[1][5];
204 |
205 | int i = 0;
206 |
207 | result[i][0] = list.getUserid();
208 | result[i][1] = list.getUsername();
209 | result[i][2] = list.isUseradmin();
210 | result[i][3] = list.getUserrange();
211 | result[i][4] = list.isUseronline();
212 |
213 | tableDatas = result;
214 | }
215 |
216 | public static void inittabledatabyrange(String range) {
217 | List list = UserInfoDao.findbyuserrange(range);
218 | Object[][] result = new Object[list.size()][5];
219 |
220 | int i = 0;
221 | for (UserInfo user : list) {
222 | result[i][0] = user.getUserid();
223 | result[i][1] = user.getUsername();
224 | result[i][2] = user.isUseradmin();
225 | result[i][3] = user.getUserrange();
226 | result[i][4] = user.isUseronline();
227 | i++;
228 | }
229 |
230 | tableDatas = result;
231 | }
232 |
233 | public static void inittabledatabyidandrange(String range, boolean online) {
234 | List list = UserInfoDao.findbyRangeAndOnline(range, online);
235 | Object[][] result = new Object[list.size()][5];
236 |
237 | int i = 0;
238 | for (UserInfo user : list) {
239 | result[i][0] = user.getUserid();
240 | result[i][1] = user.getUsername();
241 | result[i][2] = user.isUseradmin();
242 | result[i][3] = user.getUserrange();
243 | result[i][4] = user.isUseronline();
244 | i++;
245 | }
246 |
247 | tableDatas = result;
248 | }
249 |
250 | }
251 |
--------------------------------------------------------------------------------
/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
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 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleInfoPanelPackage/SettingPanelShowById.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel.EleInfoPanelPackage;
2 |
3 | import Dao.EleInfoDao;
4 | import GUI.MyIconButton;
5 | import GUI.MyTabel;
6 | import tables.EleInfo;
7 |
8 | import javax.swing.*;
9 | import javax.swing.table.DefaultTableModel;
10 | import java.awt.*;
11 | import java.util.List;
12 |
13 | public class SettingPanelShowById extends JPanel {
14 |
15 | JLabel labelid;
16 | JLabel labelrange;
17 | JTextField textid;
18 | JTextField textrange;
19 | MyIconButton buttonid;
20 | MyIconButton buttonrange;
21 | MyIconButton buttonall;
22 | MyIconButton buttonclear;
23 |
24 | JLabel info;
25 |
26 |
27 | DefaultTableModel model;
28 | public static MyTabel table;
29 | private static Object[][] tableDatas;
30 | JScrollPane panelScroll;
31 |
32 | public SettingPanelShowById() {
33 | initialize();
34 | tableDatas = new Object[1][6];
35 | addComponent();
36 | addListener();
37 | }
38 |
39 |
40 | private void initialize() {
41 | this.setBackground(Color.white);
42 | this.setLayout(new BorderLayout());
43 | }
44 |
45 | private void addComponent() {
46 | this.add(getCenterPanel(), BorderLayout.CENTER);
47 | this.add(getDownPanel(), BorderLayout.SOUTH);
48 | }
49 |
50 | private JPanel getCenterPanel() {
51 | JPanel panelCenter = new JPanel();
52 | panelCenter.setBackground(Color.white);
53 | panelCenter.setLayout(new GridLayout(2, 1));
54 |
55 |
56 | //设置Grid
57 | JPanel panelGridSetting = new JPanel();
58 | panelGridSetting.setBackground(Color.white);
59 | panelGridSetting.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 30));
60 |
61 | //初始化组件
62 | labelid = new JLabel("输入电梯id编号");
63 | labelrange = new JLabel("输入电梯区域");
64 |
65 | textid = new JTextField();
66 | textrange = new JTextField();
67 |
68 | ImageIcon icon_id = new ImageIcon("src/resources/icon/findbyid.png");
69 | ImageIcon icon_id_enable = new ImageIcon("src/resources/icon/findbyidEnable.png");
70 | ImageIcon icon_id_disable = new ImageIcon("src/resources/icon/findbyidDisable.png");
71 |
72 | ImageIcon icon_range = new ImageIcon("src/resources/icon/findbyrange.png");
73 | ImageIcon icon_range_enable = new ImageIcon("src/resources/icon/findbyrangeEnable.png");
74 | ImageIcon icon_range_disable = new ImageIcon("src/resources/icon/findbyrangeDisable.png");
75 |
76 | ImageIcon icon_clear = new ImageIcon("src/resources/icon/clear.png");
77 | ImageIcon icon_clear_enable = new ImageIcon("src/resources/icon/clearEnable.png");
78 | ImageIcon icon_clear_disable = new ImageIcon("src/resources/icon/clearDisable.png");
79 |
80 | ImageIcon icon_all = new ImageIcon("src/resources/icon/findbyboth.png");
81 | ImageIcon icon_all_enable = new ImageIcon("src/resources/icon/findbybothEnable.png");
82 | ImageIcon icon_all_disable = new ImageIcon("src/resources/icon/findbybothDisable.png");
83 |
84 | buttonid = new MyIconButton(icon_id, icon_id_enable, icon_id_disable, "id");
85 | buttonrange = new MyIconButton(icon_range, icon_range_enable, icon_range_disable, "range");
86 | buttonall = new MyIconButton(icon_all, icon_all_enable, icon_all_disable, "all");
87 | buttonclear = new MyIconButton(icon_clear, icon_clear_enable, icon_clear_disable, "clear");
88 |
89 | // 字体
90 | Font font = new Font("微软雅黑", 0, 13);
91 | labelid.setFont(font);
92 | labelrange.setFont(font);
93 | textid.setFont(font);
94 | textrange.setFont(font);
95 |
96 | // 大小
97 | Dimension SIZE = new Dimension(100, 30);
98 | labelid.setPreferredSize(SIZE);
99 | labelrange.setPreferredSize(SIZE);
100 |
101 | SIZE = new Dimension(250, 24);
102 | textid.setPreferredSize(SIZE);
103 | textrange.setPreferredSize(SIZE);
104 |
105 | panelGridSetting.add(labelid);
106 | panelGridSetting.add(textid);
107 | panelGridSetting.add(buttonid);
108 | panelGridSetting.add(labelrange);
109 | panelGridSetting.add(textrange);
110 | panelGridSetting.add(buttonrange);
111 | panelGridSetting.add(buttonclear);
112 | panelGridSetting.add(buttonall);
113 |
114 |
115 | //表格设置
116 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
117 | table = new MyTabel(model);
118 | table.Beautiful(false);
119 |
120 |
121 | //设置滚动条
122 | panelScroll = new JScrollPane(table) {
123 | public Dimension getPreferredSize() {
124 | return new Dimension(300, 60);
125 | }
126 | };
127 | panelScroll.setBackground(Color.white);
128 |
129 |
130 | panelCenter.add(panelGridSetting);
131 | panelCenter.add(panelScroll);
132 |
133 | return panelCenter;
134 | }
135 |
136 |
137 | private JPanel getDownPanel() {
138 | JPanel panelDown = new JPanel();
139 | info = new JLabel("输入查询内容");
140 |
141 | Font font = new Font("微软雅黑", 0, 12);
142 | panelDown.setFont(font);
143 | panelDown.add(info);
144 |
145 | return panelDown;
146 | }
147 |
148 |
149 | private void addListener() {
150 | buttonclear.addActionListener(e -> {
151 | textrange.setText("");
152 | textid.setText("");
153 |
154 | tableDatas = new Object[0][6];
155 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
156 | table.setModel(model);
157 | table.Beautiful(false);
158 |
159 | info.setText("已清空");
160 | });
161 |
162 |
163 | buttonid.addActionListener(e -> {
164 | if (textid.getText().equals("")) {
165 | info.setText("id不允许为空");
166 | JOptionPane.showMessageDialog(this, "id不允许为空");
167 | return;
168 | }
169 | inittableDateByid(textid.getText());
170 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
171 | table.setModel(model);
172 | table.Beautiful(false);
173 | info.setText("已更新");
174 | });
175 |
176 | buttonrange.addActionListener(e -> {
177 | if (textrange.getText().equals("")) {
178 | info.setText("Range不允许为空");
179 | JOptionPane.showMessageDialog(this, "Range不允许为空");
180 |
181 | return;
182 | }
183 | inittableDateByrange(textrange.getText());
184 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
185 | table.setModel(model);
186 | table.Beautiful(false);
187 | info.setText("已更新");
188 | });
189 |
190 | buttonall.addActionListener(e -> {
191 | if (textrange.getText().equals("") || textid.getText().equals("")) {
192 | info.setText("Range和Id都不允许为空");
193 | JOptionPane.showMessageDialog(this, "Range和Id都不允许为空");
194 | return;
195 | }
196 | inittableDateByrangeAndId(textid.getText(), textrange.getText());
197 | model = new DefaultTableModel(tableDatas, new String[]{"编号", "电梯型号", "电梯创建日期", "区域", "电梯地址", "最近维修"});
198 | table.setModel(model);
199 | table.Beautiful(false);
200 | info.setText("已更新");
201 | });
202 | }
203 |
204 |
205 | private static void inittableDateByrange(String elerange) {
206 | List list = EleInfoDao.findbyelerange(elerange);
207 | Object[][] result = new Object[list.size()][6];
208 |
209 | int i = 0;
210 | for (EleInfo ele : list) {
211 | result[i][0] = ele.getEleid();
212 | result[i][1] = ele.getEletype();
213 | result[i][2] = ele.getElecreatedate();
214 | result[i][3] = ele.getElerange();
215 | result[i][4] = ele.getEleaddress();
216 | result[i][5] = ele.getElelastmtdate();
217 | i++;
218 | }
219 | tableDatas = result;
220 | }
221 |
222 | private static void inittableDateByid(String id) {
223 | EleInfo list = EleInfoDao.findbyeleid(id);
224 | Object[][] result = new Object[1][6];
225 | result[0][0] = list.getEleid();
226 | result[0][1] = list.getEletype();
227 | result[0][2] = list.getElecreatedate();
228 | result[0][3] = list.getElerange();
229 | result[0][4] = list.getEleaddress();
230 | result[0][5] = list.getElelastmtdate();
231 | tableDatas = result;
232 | }
233 |
234 | private static void inittableDateByrangeAndId(String eleid, String elerange) {
235 | List list = EleInfoDao.findbyrangeandid(eleid, elerange);
236 | Object[][] result = new Object[list.size()][6];
237 |
238 | int i = 0;
239 | for (EleInfo ele : list) {
240 | result[i][0] = ele.getEleid();
241 | result[i][1] = ele.getEletype();
242 | result[i][2] = ele.getElecreatedate();
243 | result[i][3] = ele.getElerange();
244 | result[i][4] = ele.getEleaddress();
245 | result[i][5] = ele.getElelastmtdate();
246 | i++;
247 | }
248 | tableDatas = result;
249 | }
250 |
251 |
252 | }
253 |
--------------------------------------------------------------------------------
/src/GUI/Panel/EleInfoPanel.java:
--------------------------------------------------------------------------------
1 | package GUI.Panel;
2 |
3 | import GUI.AppMainWindow;
4 | import GUI.Panel.EleInfoPanelPackage.*;
5 |
6 | import javax.swing.*;
7 | import java.awt.*;
8 | import java.awt.event.MouseEvent;
9 | import java.awt.event.MouseListener;
10 |
11 | public class EleInfoPanel extends JPanel {
12 | //主界面跳转
13 | public static JPanel settingpanelshowall;
14 | public static JPanel settingpanelshowbyid;
15 | public static JPanel settingpaneladdone;
16 | public static JPanel settingpaneldeleteone;
17 | public static JPanel settingpanelupdateone;
18 |
19 | public static JPanel settingPanelMain;
20 |
21 | //子菜单按钮选项
22 | public static JPanel panelshowall;
23 | public static JPanel panelshowbyid;
24 | public static JPanel paneladdone;
25 | public static JPanel paneldeleteone;
26 | public static JPanel panelupdateone;
27 |
28 | //子菜单标签
29 | public static JLabel labelshowall;
30 | public static JLabel labelshowbyid;
31 | public static JLabel labeladdone;
32 | public static JLabel labeldeleteone;
33 | public static JLabel labelupdateone;
34 |
35 | /**
36 | * 构造
37 | */
38 | public EleInfoPanel() {
39 | initialize();
40 | addComponent();
41 | addListener();
42 | }
43 |
44 |
45 | /**
46 | * 初始化
47 | */
48 | private void initialize() {
49 | this.setBackground(Color.white);
50 | this.setLayout(new BorderLayout());
51 | settingpanelshowall = new SettingPanelShowall();
52 | settingpanelshowbyid = new SettingPanelShowById();
53 | settingpaneladdone = new SettingPanelAddone();
54 | settingpaneldeleteone = new SettingPanelDeleteone();
55 | settingpanelupdateone = new SettingPanelUpdateone();
56 | }
57 |
58 | private void addComponent() {
59 | this.add(getUpPanel(), BorderLayout.NORTH);
60 | this.add(getCenterPanel(), BorderLayout.CENTER);
61 | }
62 |
63 | private JPanel getUpPanel() {
64 | JPanel panelUp = new JPanel();
65 | panelUp.setBackground(Color.white);
66 | panelUp.setLayout(new FlowLayout(FlowLayout.LEFT, 25, 5));
67 |
68 | JLabel labeltitle = new JLabel("电梯信息操作");
69 |
70 | Font font = new Font("微软雅黑", 0, 27);
71 | labeltitle.setFont(font);
72 | labeltitle.setForeground(new Color(37, 174, 96));
73 | panelUp.add(labeltitle);
74 |
75 | return panelUp;
76 | }
77 |
78 | private JPanel getCenterPanel() {
79 | //面板
80 | JPanel panelCenter = new JPanel();
81 | panelCenter.setBackground(Color.white);
82 | panelCenter.setLayout(new BorderLayout());
83 |
84 | //二级菜单panel
85 | JPanel panellist = new JPanel();
86 | Dimension SIZE = new Dimension(200, 636);
87 | panellist.setPreferredSize(SIZE);
88 | panellist.setBackground(new Color(62, 62, 62));
89 | panellist.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
90 |
91 | //new子选项
92 | paneladdone = new JPanel();
93 | paneladdone.setBackground(new Color(37, 174, 96));
94 | paneladdone.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
95 | SIZE = new Dimension(200, 48);
96 | paneladdone.setPreferredSize(SIZE);
97 |
98 | panelshowbyid = new JPanel();
99 | panelshowbyid.setBackground(new Color(37, 174, 96));
100 | panelshowbyid.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
101 | SIZE = new Dimension(200, 48);
102 | panelshowbyid.setPreferredSize(SIZE);
103 |
104 | panelshowall = new JPanel();
105 | panelshowall.setBackground(new Color(69, 186, 121));
106 | panelshowall.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
107 | SIZE = new Dimension(200, 48);
108 | panelshowall.setPreferredSize(SIZE);
109 |
110 | paneldeleteone = new JPanel();
111 | paneldeleteone.setBackground(new Color(37, 174, 96));
112 | paneldeleteone.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
113 | SIZE = new Dimension(200, 48);
114 | paneldeleteone.setPreferredSize(SIZE);
115 |
116 | panelupdateone = new JPanel();
117 | panelupdateone.setBackground(new Color(37, 174, 96));
118 | panelupdateone.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 13));
119 | SIZE = new Dimension(200, 48);
120 | panelupdateone.setPreferredSize(SIZE);
121 |
122 |
123 | //Label添加标签
124 | labelshowall = new JLabel("显示所有信息");
125 | labelshowbyid = new JLabel("查询电梯");
126 | labeladdone = new JLabel("添加电梯");
127 | labeldeleteone = new JLabel("删除电梯");
128 | labelupdateone = new JLabel("更新电梯信息");
129 | //设置字体
130 | Font font = new Font("微软雅黑", 0, 15);
131 | labelshowall.setFont(font);
132 | labelshowbyid.setFont(font);
133 | labeladdone.setFont(font);
134 | labeldeleteone.setFont(font);
135 | labelupdateone.setFont(font);
136 | //设置背景透明
137 | labelshowall.setForeground(Color.white);
138 | labelshowbyid.setForeground(Color.white);
139 | labeladdone.setForeground(Color.white);
140 | labeldeleteone.setForeground(Color.white);
141 | labelupdateone.setForeground(Color.white);
142 |
143 | //标签显示文字
144 | panelshowall.add(labelshowall);
145 | panelshowbyid.add(labelshowbyid);
146 | paneladdone.add(labeladdone);
147 | paneldeleteone.add(labeldeleteone);
148 | panelupdateone.add(labelupdateone);
149 |
150 | //添加菜单
151 | panellist.add(panelshowall);
152 | panellist.add(panelshowbyid);
153 | panellist.add(paneladdone);
154 | panellist.add(paneldeleteone);
155 | panellist.add(panelupdateone);
156 |
157 | //设置panel
158 | settingPanelMain = new JPanel();
159 | settingPanelMain.setBackground(Color.white);
160 | settingPanelMain.setLayout(new BorderLayout());
161 | settingPanelMain.add(settingpanelshowall, BorderLayout.CENTER);
162 |
163 | panelCenter.add(panellist, BorderLayout.WEST);
164 | panelCenter.add(settingPanelMain, BorderLayout.CENTER);
165 |
166 | return panelCenter;
167 | }
168 |
169 | /**
170 | * 添加事件监听
171 | */
172 | private void addListener() {
173 | panelshowall.addMouseListener(new MouseListener() {
174 | @Override
175 | public void mouseClicked(MouseEvent e) {
176 | panelshowall.setBackground(new Color(37, 174, 96));
177 | panelshowbyid.setBackground(new Color(37, 174, 96));
178 | paneladdone.setBackground(new Color(37, 174, 96));
179 | paneldeleteone.setBackground(new Color(37, 174, 96));
180 | panelupdateone.setBackground(new Color(37, 174, 96));
181 |
182 | panelshowall.setBackground(new Color(69, 186, 121));
183 |
184 | EleInfoPanel.settingPanelMain.removeAll();
185 | EleInfoPanel.settingPanelMain.add(settingpanelshowall, BorderLayout.CENTER);
186 | AppMainWindow.mainPanelCenter.updateUI();
187 |
188 | }
189 |
190 | @Override
191 | public void mousePressed(MouseEvent e) {
192 |
193 | }
194 |
195 | @Override
196 | public void mouseReleased(MouseEvent e) {
197 |
198 | }
199 |
200 | @Override
201 | public void mouseEntered(MouseEvent e) {
202 |
203 | }
204 |
205 | @Override
206 | public void mouseExited(MouseEvent e) {
207 |
208 | }
209 | });
210 |
211 | panelshowbyid.addMouseListener(new MouseListener() {
212 | @Override
213 | public void mouseClicked(MouseEvent e) {
214 | panelshowall.setBackground(new Color(37, 174, 96));
215 | panelshowbyid.setBackground(new Color(37, 174, 96));
216 | paneladdone.setBackground(new Color(37, 174, 96));
217 | paneldeleteone.setBackground(new Color(37, 174, 96));
218 | panelupdateone.setBackground(new Color(37, 174, 96));
219 |
220 | panelshowbyid.setBackground(new Color(69, 186, 121));
221 |
222 | EleInfoPanel.settingPanelMain.removeAll();
223 | EleInfoPanel.settingPanelMain.add(settingpanelshowbyid, BorderLayout.CENTER);
224 |
225 | AppMainWindow.mainPanelCenter.updateUI();
226 | }
227 |
228 | @Override
229 | public void mousePressed(MouseEvent e) {
230 |
231 | }
232 |
233 | @Override
234 | public void mouseReleased(MouseEvent e) {
235 |
236 | }
237 |
238 | @Override
239 | public void mouseEntered(MouseEvent e) {
240 |
241 | }
242 |
243 | @Override
244 | public void mouseExited(MouseEvent e) {
245 |
246 | }
247 | });
248 |
249 | paneladdone.addMouseListener(new MouseListener() {
250 | @Override
251 | public void mouseClicked(MouseEvent e) {
252 | panelshowall.setBackground(new Color(37, 174, 96));
253 | panelshowbyid.setBackground(new Color(37, 174, 96));
254 | paneladdone.setBackground(new Color(37, 174, 96));
255 | paneldeleteone.setBackground(new Color(37, 174, 96));
256 | panelupdateone.setBackground(new Color(37, 174, 96));
257 |
258 | paneladdone.setBackground(new Color(69, 186, 121));
259 |
260 | EleInfoPanel.settingPanelMain.removeAll();
261 | EleInfoPanel.settingPanelMain.add(settingpaneladdone, BorderLayout.CENTER);
262 |
263 | AppMainWindow.mainPanelCenter.updateUI();
264 | }
265 |
266 | @Override
267 | public void mousePressed(MouseEvent e) {
268 |
269 | }
270 |
271 | @Override
272 | public void mouseReleased(MouseEvent e) {
273 |
274 | }
275 |
276 | @Override
277 | public void mouseEntered(MouseEvent e) {
278 |
279 | }
280 |
281 | @Override
282 | public void mouseExited(MouseEvent e) {
283 |
284 | }
285 | });
286 |
287 | paneldeleteone.addMouseListener(new MouseListener() {
288 | @Override
289 | public void mouseClicked(MouseEvent e) {
290 | panelshowall.setBackground(new Color(37, 174, 96));
291 | panelshowbyid.setBackground(new Color(37, 174, 96));
292 | paneladdone.setBackground(new Color(37, 174, 96));
293 | paneldeleteone.setBackground(new Color(37, 174, 96));
294 | panelupdateone.setBackground(new Color(37, 174, 96));
295 |
296 | paneldeleteone.setBackground(new Color(69, 186, 121));
297 |
298 | EleInfoPanel.settingPanelMain.removeAll();
299 | EleInfoPanel.settingPanelMain.add(settingpaneldeleteone, BorderLayout.CENTER);
300 |
301 | AppMainWindow.mainPanelCenter.updateUI();
302 | }
303 |
304 | @Override
305 | public void mousePressed(MouseEvent e) {
306 |
307 | }
308 |
309 | @Override
310 | public void mouseReleased(MouseEvent e) {
311 |
312 | }
313 |
314 | @Override
315 | public void mouseEntered(MouseEvent e) {
316 |
317 | }
318 |
319 | @Override
320 | public void mouseExited(MouseEvent e) {
321 |
322 | }
323 | });
324 |
325 | panelupdateone.addMouseListener(new MouseListener() {
326 | @Override
327 | public void mouseClicked(MouseEvent e) {
328 | panelshowall.setBackground(new Color(37, 174, 96));
329 | panelshowbyid.setBackground(new Color(37, 174, 96));
330 | paneladdone.setBackground(new Color(37, 174, 96));
331 | paneldeleteone.setBackground(new Color(37, 174, 96));
332 | panelupdateone.setBackground(new Color(37, 174, 96));
333 |
334 | panelupdateone.setBackground(new Color(69, 186, 121));
335 |
336 | EleInfoPanel.settingPanelMain.removeAll();
337 | EleInfoPanel.settingPanelMain.add(settingpanelupdateone, BorderLayout.CENTER);
338 |
339 | AppMainWindow.mainPanelCenter.updateUI();
340 | }
341 |
342 | @Override
343 | public void mousePressed(MouseEvent e) {
344 |
345 | }
346 |
347 | @Override
348 | public void mouseReleased(MouseEvent e) {
349 |
350 | }
351 |
352 | @Override
353 | public void mouseEntered(MouseEvent e) {
354 |
355 | }
356 |
357 | @Override
358 | public void mouseExited(MouseEvent e) {
359 |
360 | }
361 | });
362 | }
363 | }
364 |
--------------------------------------------------------------------------------