📄 sellcorp.java
字号:
package clientpack;
import javax.swing.ListSelectionModel;
import java.util.Vector;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Rectangle;
import java.awt.Dimension;
import java.io.PrintStream;
import java.util.Scanner;
import java.awt.Toolkit;
import javax.swing.JPasswordField;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class SellCorp extends JFrame {
private static final long serialVersionUID = 1L;
private String id;
private MyMessage mm;
private Message mes;
private boolean iflog;
private int RowNumBank;
private JButton bankrecord_jButton = null;
private JPanel bankrecord_jPanel = null;
private JScrollPane bankrecord_jScrollPane = null;
private JTable bankrecord_jTable = null;
private JButton payback_jButton = null;
private JButton loanview_jButton = null;
private JPanel jContentPane = null;
private JButton personalbank = null;
private JPanel bankPanel = null;
private JPanel softwarePanel = null;
private JPanel restaurantPanel = null;
private JButton checkaccount = null;
private JButton deposit = null;
private JButton withdraw = null;
private JButton transfer = null;
private JButton loan = null;
private JPanel bankenterPanel = null;
private JPasswordField jPasswordField = null;
private JLabel jLabel = null;
private JButton enter = null;
private JLabel jLabel1 = null;
private JButton newaccount = null;
private JPanel regaccountPanel = null;
private JPasswordField regpassword = null;
private JPasswordField regpasswordconfirm = null;
private JTextField regaccount = null;
private JTextField regcash = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JButton regok = null;
private JButton regback = null;
private JTextField bankpanel_jTextField = null;
private JTextField bankpanel_jTextField2 = null;
private JLabel jLabel6 = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JButton bankpanel_deposit = null;
private JButton bankpanel_withdraw = null;
private JButton bankpanel_transfer = null;
private JButton bankpanel_loan = null;
private JLabel note_jLabel = null;
private JButton SellAllViewButton = new JButton();
private JScrollPane SellAllPanel = new JScrollPane();
private String[] SellAllColumnname = {"软件名称","软件描述","价格","库存","售出","Developed_id","开发公司"};
private String[] FeedbackColumnname = {"软件名称","Developed_id","开发公司","反馈意见","顾客姓名"};
private String[] CustomerColumnname = {"软件名称","Customer_id","顾客姓名","价格","售出时间"};
private DefaultTableModel SellAlldatamode = new DefaultTableModel(null,SellAllColumnname)
{
public boolean isCellEditable(int row, int column) {
return false;
}
};
private DefaultTableModel Feedbackdatamode = new DefaultTableModel(null,FeedbackColumnname) {
public boolean isCellEditable(int row, int column) {
return false;
}
};
private DefaultTableModel Customerdatamode = new DefaultTableModel(null,CustomerColumnname) {
public boolean isCellEditable(int row, int column) {
return false;
}
};
private JTable SellAllTable = new JTable(SellAlldatamode);
private JButton FeedBackButton = new JButton();
private JScrollPane FeedbackPanel = new JScrollPane();
private JTable FeedbackTable = new JTable(Feedbackdatamode);
private JButton CustomerButton = new JButton();
private JScrollPane CustomerPanel = new JScrollPane();
private JTable CustomerTable = new JTable(Customerdatamode);
private JButton FinanceButton = new JButton();
private JPanel FinancePanel = new JPanel();
private JLabel SellAllAccountLabel = new JLabel();
private JTextField AllAccountTextField = new JTextField();
private JLabel ProfitLabel = new JLabel();
private JTextField ProfitTextField = new JTextField();
private JButton balanceButton = new JButton();
public SellCorp(Scanner pin, PrintStream pout,String sid) {
super();
initialize();
id = sid;
mes = new Message(pin,pout);
mm = new MyMessage();
iflog = false;
setCenter();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(722, 520);
this.setContentPane(getJContentPane());
this.setTitle("SoftSellCorp");
this.setVisible(true);
balanceButton.setBounds(new Rectangle(120, 85, 100, 25));
balanceButton.setText("结算");
SellAllViewButton.setBounds(new Rectangle(147, 21, 98, 28));
SellAllViewButton.setText("软件清单");
SellAllViewButton.addActionListener(new
SellCorp_SellAllViewButton_actionAdapter(this));
SellAllPanel.setBounds(new Rectangle(5, 91, 695, 381));
FeedBackButton.setBounds(new Rectangle(247, 21, 98, 28));
FeedBackButton.setText("客户反馈");
FeedBackButton.addActionListener(new
SellCorp_FeedBackButton_actionAdapter(this));
FeedbackPanel.setBounds(new Rectangle(5, 91, 695, 381));
CustomerButton.setBounds(new Rectangle(347, 21, 98, 28));
CustomerButton.setText("客户清单");
CustomerButton.addActionListener(new
SellCorp_CustomerButton_actionAdapter(this));
balanceButton.addActionListener(new
SellCorp_balanceButton_actionAdapter(this));
CustomerPanel.setBounds(new Rectangle(5, 91, 695, 381));
FinanceButton.setBounds(new Rectangle(447, 21, 98, 28));
FinanceButton.setText("账目统计");
FinanceButton.addActionListener(new
SellCorp_FinanceButton_actionAdapter(this));
FinancePanel.setBounds(new Rectangle(206, 133, 270, 166));
FinancePanel.setLayout(null);
SellAllAccountLabel.setText("销售总额:");
SellAllAccountLabel.setBounds(new Rectangle(45, 6, 94, 26));
AllAccountTextField.setText("");
AllAccountTextField.setBounds(new Rectangle(104, 6, 127, 26));
ProfitLabel.setText("进账总额:");
ProfitLabel.setBounds(new Rectangle(45, 45, 94, 26));
ProfitTextField.setBounds(new Rectangle(104, 45, 127, 26));
jContentPane.add(SellAllPanel);
jContentPane.add(FeedbackPanel);
jContentPane.add(CustomerPanel);
jContentPane.add(FinancePanel);
FinancePanel.add(SellAllAccountLabel);
FinancePanel.add(AllAccountTextField);
FinancePanel.add(ProfitTextField);
FinancePanel.add(ProfitLabel);
FinancePanel.add(balanceButton);
jContentPane.add(SellAllViewButton);
jContentPane.add(FeedBackButton);
jContentPane.add(CustomerButton);
jContentPane.add(FinanceButton);
CustomerPanel.getViewport().add(CustomerTable);
FeedbackPanel.getViewport().add(FeedbackTable);
SellAllPanel.getViewport().add(SellAllTable);
SellAllPanel.setVisible(false);
FeedbackPanel.setVisible(false);
CustomerPanel.setVisible(false);
FinancePanel.setVisible(false);
}
public void setCenter() {
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int width = screenSize.width;
int height = screenSize.height;
final int WIDTH = 722;
final int HEIGHT = 520;
int x = (width - WIDTH) / 2;
int y = (height - HEIGHT) / 2;
setLocation(x, y);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
note_jLabel = new JLabel();
note_jLabel.setBounds(new Rectangle(83, 68, 338, 18));
note_jLabel.setText("Please choose where to go.");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getPersonalbank(), null);
jContentPane.add(getBankPanel(), null);
jContentPane.add(getBankenterPanel(), null);
jContentPane.add(getRegaccountPanel(), null);
jContentPane.add(note_jLabel, null);
bankenterPanel.setVisible(false);
regaccountPanel.setVisible(false);
bankPanel.setVisible(false);
}
return jContentPane;
}
/**
* This method initializes personalbank
*
* @return javax.swing.JButton
*/
private JButton getPersonalbank() {
if (personalbank == null) {
personalbank = new JButton("银行");
personalbank.setBounds(new Rectangle(47, 21, 98, 28));
personalbank.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// TODO Auto-generated Event stub actionPerformed()
note_jLabel.setText("You are now in the bank.");
SellAllPanel.setVisible(false);
FeedbackPanel.setVisible(false);
CustomerPanel.setVisible(false);
FinancePanel.setVisible(false);
if (iflog) {
bankenterPanel.setVisible(false);
bankPanel.setVisible(true);
} else {
bankenterPanel.setVisible(true);
bankPanel.setVisible(false);
}
}
});
}
return personalbank;
}
private JPanel getBankPanel() {
if (bankPanel == null) {
jLabel8 = new JLabel();
jLabel8.setBounds(new Rectangle(222, 83, 254, 40));
jLabel8.setText("Welcome to the bank!");
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(208, 192, 31, 15));
jLabel7.setText("");
jLabel6 = new JLabel();
jLabel6.setBounds(new Rectangle(193, 154, 49, 15));
jLabel6.setText("");
bankPanel = new JPanel();
bankPanel.setLayout(null);
bankPanel.setBounds(new Rectangle(28, 90, 662, 381)); /////////////////////////////
bankPanel.add(getCheckaccount(), null);
bankPanel.add(getDeposit(), null);
bankPanel.add(getWithdraw(), null);
bankPanel.add(getTransfer(), null);
bankPanel.add(getLoan(), null);
bankPanel.add(getBankpanel_jTextField(), null);
bankPanel.add(getBankpanel_jTextField2(), null);
bankPanel.add(jLabel6, null);
bankPanel.add(jLabel7, null);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -