?? softdevelop.java
字號(hào):
bankenterPanel.setVisible(true);
regaccountPanel.setVisible(false);
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void LoginBank()
{
try{
if("".equals(jPasswordField.getText().trim()))
{
JOptionPane.showMessageDialog(null,"Please enter your password!");
return;
}
mm.SetType("LoginBank");
mm.SetNum(2);
mm.SetMes(id, 0);
mm.SetMes(jPasswordField.getText().trim(), 1);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("OK".equals(mm.GetType()))
{
jPasswordField.setText("");
bankenterPanel.setVisible(false);
regaccountPanel.setVisible(false);
bankPanel.setVisible(true);
// softwarePanel.setVisible(false);
// restaurantPanel.setVisible(false);
// myrecord_jScrollPane.setVisible(false);
iflog = true;
}
else if("WID".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"You don't have an account in the bank!");
jPasswordField.setText("");
return;
}
else if("WPASS".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"Wrong password!");
return;
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
return;
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void CheckAccount()
{
try{
mm.SetType("CheckAccount");
mm.SetNum(1);
mm.SetMes(id, 0);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
bankpanel_jTextField.setText(mm.GetMes(0));
bankpanel_jTextField2.setText(mm.GetMes(1));
jLabel8.setText("Register time:"+mm.GetMes(2));
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void DepositOK()
{
try{
if("".equals(bankpanel_jTextField.getText().trim()))
{
JOptionPane.showMessageDialog(null,"Please enter the account!");
return;
}
mm.SetType("Deposit");
mm.SetNum(2);
mm.SetMes(id, 0);
mm.SetMes(bankpanel_jTextField.getText().trim(), 1);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
bankpanel_jTextField.setText("");
JOptionPane.showMessageDialog(null,"Deposit success!");
}
else if("false".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"Cash not enough!");
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void WithdrawOK()
{
try{
if("".equals(bankpanel_jTextField.getText().trim()))
{
JOptionPane.showMessageDialog(null,"Please enter the account!");
return;
}
mm.SetType("Withdraw");
mm.SetNum(2);
mm.SetMes(id, 0);
mm.SetMes(bankpanel_jTextField.getText().trim(), 1);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
bankpanel_jTextField.setText("");
JOptionPane.showMessageDialog(null,"Withdraw success!");
}
else if("notenough".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"Banance not enough!");
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void TransferOK()
{
try{
if("".equals(bankpanel_jTextField.getText().trim()))
{
JOptionPane.showMessageDialog(null,"Please enter the account!");
return;
}
if("".equals(bankpanel_jTextField2.getText().trim()))
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
return;
}
mm.SetType("Transfer");
mm.SetNum(3);
mm.SetMes(id, 0);
mm.SetMes(bankpanel_jTextField2.getText().trim(), 1);
mm.SetMes(bankpanel_jTextField.getText().trim(), 2);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
bankpanel_jTextField.setText("");
bankpanel_jTextField2.setText("");
JOptionPane.showMessageDialog(null,"Transfer success!");
}
else if("notenough".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"Banance not enough!");
}
else if("notexsit".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"id doesn't exsit!");
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void LoanOK()
{
try{
if("".equals(bankpanel_jTextField.getText().trim()))
{
JOptionPane.showMessageDialog(null,"Please enter the account!");
return;
}
mm.SetType("Loan");
mm.SetNum(2);
mm.SetMes(id, 0);
mm.SetMes(bankpanel_jTextField.getText().trim(), 1);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
bankpanel_jTextField.setText("");
JOptionPane.showMessageDialog(null,"Request has been sent!");
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private JButton getBankrecord_jButton() {
if (bankrecord_jButton == null) {
bankrecord_jButton = new JButton("銀行記錄");
bankrecord_jButton.setBounds(new Rectangle(537, 31, 89, 26));
bankrecord_jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// TODO Auto-generated Event stub actionPerformed()
bankpanel_deposit.setVisible(false);
bankpanel_withdraw.setVisible(false);
bankpanel_transfer.setVisible(false);
bankpanel_loan.setVisible(false);
bankpanel_jTextField2.setVisible(false);
bankpanel_jTextField.setVisible(false);
jLabel6.setText("");
bankpanel_jTextField.setText("");
bankpanel_jTextField2.setText("");
jLabel8.setText("");
jLabel7.setText("");
bankrecord_jPanel.setVisible(true);
loanview_jButton.setVisible(true);
payback_jButton.setVisible(false);
RowNumBank = -1;
CorpRecord();
}
});
}
return bankrecord_jButton;
}
/**
* This method initializes bankrecord_jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getBankrecord_jPanel() {
if (bankrecord_jPanel == null) {
bankrecord_jPanel = new JPanel();
bankrecord_jPanel.setLayout(null);
bankrecord_jPanel.setBounds(new Rectangle(17, 69, 631, 300));
bankrecord_jPanel.add(getBankrecord_jScrollPane(), null);
bankrecord_jPanel.add(getPayback_jButton(), null);
bankrecord_jPanel.add(getLoanview_jButton(), null);
}
return bankrecord_jPanel;
}
/**
* This method initializes bankrecord_jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getBankrecord_jScrollPane() {
if (bankrecord_jScrollPane == null) {
bankrecord_jScrollPane = new JScrollPane();
bankrecord_jScrollPane.setBounds(new Rectangle(2, 2, 625, 264));
bankrecord_jScrollPane.setViewportView(getBankrecord_jTable());
}
return bankrecord_jScrollPane;
}
/**
* This method initializes bankrecord_jTable
*
* @return javax.swing.JTable
*/
private JTable getBankrecord_jTable() {
if (bankrecord_jTable == null) {
bankrecord_jTable = new JTable();
bankrecord_jTable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
// TODO Auto-generated Event stub mouseClicked()
RowNumBank = bankrecord_jTable.rowAtPoint(e.getPoint());
}
});
}
return bankrecord_jTable;
}
/**
* This method initializes payback_jButton
*
* @return javax.swing.JButton
*/
private JButton getPayback_jButton() {
if (payback_jButton == null) {
payback_jButton = new JButton("Payback");
payback_jButton.setBounds(new Rectangle(497, 271, 85, 24));
payback_jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// TODO Auto-generated Event stub actionPerformed()
if(RowNumBank == -1)
{
JOptionPane.showMessageDialog(null,"Please choose one!");
return;
}
if("payed".equals(bankrecord_jTable.getValueAt(RowNumBank, 0)))
{
JOptionPane.showMessageDialog(null,"You already payed back!");
return;
}
Payback();
}
});
}
return payback_jButton;
}
/**
* This method initializes loanview_jButton
*
* @return javax.swing.JButton
*/
private JButton getLoanview_jButton() {
if (loanview_jButton == null) {
loanview_jButton = new JButton("欠款清單");
loanview_jButton.setBounds(new Rectangle(497, 271, 85, 24));
loanview_jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// TODO Auto-generated Event stub actionPerformed()
RowNumBank = -1;
CorpLoan();
loanview_jButton.setVisible(false);
payback_jButton.setVisible(true);
}
});
}
return loanview_jButton;
}
private void CorpRecord()
{
DefaultTableModel model = new DefaultTableModel()
{
public boolean isCellEditable(int row, int column) {
return false;
}
};
Vector data = new Vector();
Vector columnNames = new Vector();
columnNames.addElement("活動(dòng)類型");
columnNames.addElement("金額");
columnNames.addElement("附加信息");
columnNames.addElement("時(shí)間");
model.setDataVector(data,columnNames);
bankrecord_jTable.setModel(model);
bankrecord_jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
try{
mm.SetType("CorpRecord");
mm.SetNum(1);
mm.SetMes(id, 0);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
int n = mm.GetNum()/4;
for(int i = 0; i < n; i++)
{
model.addRow(new Object[]{mm.GetMes(4*i),mm.GetMes(4*i+1),
mm.GetMes(4*i+2),mm.GetMes(4*i+3)});
}
}
else if("false".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"No record!");
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void CorpLoan()
{
DefaultTableModel model = new DefaultTableModel()
{
public boolean isCellEditable(int row, int column) {
return false;
}
};
Vector data = new Vector();
Vector columnNames = new Vector();
columnNames.addElement("欠款清單");
columnNames.addElement("金額");
columnNames.addElement("時(shí)間");
model.setDataVector(data,columnNames);
bankrecord_jTable.setModel(model);
bankrecord_jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
try{
mm.SetType("CorpLoan");
mm.SetNum(1);
mm.SetMes(id, 0);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
int n = mm.GetNum()/3;
for(int i = 0; i < n; i++)
{
model.addRow(new Object[]{mm.GetMes(3*i),mm.GetMes(3*i+1),
mm.GetMes(3*i+2)});
}
}
else if("false".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"No record!");
}
else
{
JOptionPane.showMessageDialog(null,"Error!");
}
}catch(Exception ie)
{
JOptionPane.showMessageDialog(null,"Network exception,please exit and log!");
}
}
private void Payback()
{
try{
mm.SetType("Payback");
mm.SetNum(2);
mm.SetMes(id, 0);
mm.SetMes(""+bankrecord_jTable.getValueAt(RowNumBank, 2), 1);
mes.SendMessage(mm);
mes.GetMessage(mm);
if("true".equals(mm.GetType()))
{
JOptionPane.showMessageDialog(null,"Payback success!");
bankrecord_jTable.setValueAt("payed",RowNumBank, 0);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -