📄 dailygusetframe.java
字号:
}
public void Months() {
this.cboMonth.addItem("01");
this.cboMonth.addItem("02");
this.cboMonth.addItem("03");
this.cboMonth.addItem("04");
this.cboMonth.addItem("05");
this.cboMonth.addItem("06");
this.cboMonth.addItem("07");
this.cboMonth.addItem("08");
this.cboMonth.addItem("09");
this.cboMonth.addItem("10");
this.cboMonth.addItem("11");
this.cboMonth.addItem("12");
}
public void days() {
this.cboday.addItem("01");
this.cboday.addItem("02");
this.cboday.addItem("03");
this.cboday.addItem("04");
this.cboday.addItem("05");
this.cboday.addItem("06");
this.cboday.addItem("07");
this.cboday.addItem("08");
this.cboday.addItem("09");
this.cboday.addItem("10");
this.cboday.addItem("11");
this.cboday.addItem("12");
this.cboday.addItem("13");
this.cboday.addItem("14");
this.cboday.addItem("15");
this.cboday.addItem("16");
this.cboday.addItem("17");
this.cboday.addItem("18");
this.cboday.addItem("19");
this.cboday.addItem("20");
this.cboday.addItem("21");
this.cboday.addItem("22");
this.cboday.addItem("23");
this.cboday.addItem("24");
this.cboday.addItem("25");
this.cboday.addItem("26");
this.cboday.addItem("27");
this.cboday.addItem("28");
this.cboday.addItem("29");
this.cboday.addItem("30");
this.cboday.addItem("31");
}
public void getCal() {
year = cal.get(Calendar.YEAR);
month = cal.get(Calendar.MONTH) + 1;
day = cal.get(Calendar.DATE);
//判断年
for (int i = 0; i < this.cboYear.getItemCount(); i++) {
if (this.cboYear.getItemAt(i).toString().equals("" + year)) {
this.cboYear.setSelectedIndex(i);
}
}
if (month < 10) {
this.cboMonth.setSelectedItem("0" + month);
} else {
this.cboMonth.setSelectedItem("" + month);
}
//判断月份
for (int i = 0; i < this.cboMonth.getItemCount(); i++) {
String mon = "";
if (month < 10) {
mon = "0" + month;
} else {
mon = "" + month;
}
if (this.cboMonth.getItemAt(i).toString().equals(mon)) {
this.cboMonth.setSelectedIndex(i);
}
}
if (day < 10) {
this.cboday.setSelectedItem("0" + day);
} else {
this.cboday.setSelectedItem("" + day);
}
//判断日期
for (int i = 0; i < this.cboday.getItemCount(); i++) {
String da = "";
if (day < 10) {
da = "0" + day;
} else {
da = "" + day;
}
if (this.cboday.getItemAt(i).toString().equals(da)) {
this.cboday.setSelectedIndex(i);
}
}
}
public void cboMonth_itemStateChanged(ItemEvent e) {
cboday.removeAllItems();
days();
int ye = Integer.parseInt(this.cboYear.getSelectedItem().toString());
if ((ye % 4 == 0 && ye % 100 != 0) || ye % 400 == 0) {
flag = 1;
} else {
flag = 0;
}
String mo = this.cboMonth.getSelectedItem().toString();
if (mo == "04" || mo == "06" || mo == "09" || mo == "11") {
this.cboday.removeItem("31");
}
if (flag == 1) {
if (mo.equals("02")) {
this.cboday.removeItem("31");
this.cboday.removeItem("30");
}
} else {
if (mo.equals("02")) {
this.cboday.removeItem("31");
this.cboday.removeItem("30");
this.cboday.removeItem("29");
}
}
}
public void jButton2_actionPerformed(ActionEvent e) {
Vector v = new Vector();
dtm = new DefaultTableModel();
dtm.addColumn("客人姓名");
dtm.addColumn("抵店日期");
dtm.addColumn("离店日期");
dtm.addColumn("房间号");
dtm.addColumn("房间类别");
dtm.addColumn("折扣价");
dtm.addColumn("押金");
dtm.addColumn("总额");
this.tblaccount.setModel(dtm);
ResultSet rs = dbo.returnQuery("select name,CheckInDate,CheckOutDate,roomno,class,RebatePri,Deposit,Total from register");
try {
while (rs.next()) {
v = new Vector();
v.add(rs.getString("name"));
v.add(rs.getString("CheckInDate"));
v.add(rs.getString("CheckOutDate"));
v.add(rs.getString("roomno"));
v.add(rs.getString("class"));
v.add(rs.getString("RebatePri"));
v.add(rs.getString("Deposit"));
v.add(rs.getString("Total"));
dtm.addRow(v);
}
this.tblaccount.setModel(dtm);
} catch (SQLException ex) {
ex.printStackTrace();
}
}
class AccountFrame_cboMonth_itemAdapter implements ItemListener {
private DailyGusetFrame adaptee;
AccountFrame_cboMonth_itemAdapter(DailyGusetFrame adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.cboMonth_itemStateChanged(e);
}
}
class AccountFrame_cboYear_itemAdapter implements ItemListener {
private DailyGusetFrame adaptee;
AccountFrame_cboYear_itemAdapter(DailyGusetFrame adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.cboYear_itemStateChanged(e);
}
}
class AccountFrame_jButton1_actionAdapter implements ActionListener {
private DailyGusetFrame adaptee;
AccountFrame_jButton1_actionAdapter(DailyGusetFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class AccountFrame_btnsee_actionAdapter implements ActionListener {
private DailyGusetFrame adaptee;
AccountFrame_btnsee_actionAdapter(DailyGusetFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnsee_actionPerformed(e);
}
}
}
class AccountFrame_jButton2_actionAdapter implements ActionListener {
private DailyGusetFrame adaptee;
AccountFrame_jButton2_actionAdapter(DailyGusetFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -