📄 shophostui.java
字号:
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
else
if(index==2)
{
String Msg=ConstanValue.MSG_HISTORY_SAILER;
try{
os.writeObject(Msg);
os.flush();
Msg=(String)is.readObject();
if(Msg.equals(ConstanValue.MSG_HISTORY_SAILER))
{
CachedRowSet crs=(CachedRowSet)is.readObject();
ResultSetMetaData md=crs.getMetaData();
int c=md.getColumnCount();
if(crs.isBeforeFirst())
{
crs.beforeFirst();
}
int i=0;
while(crs.next())
{
String customerId=crs.getString("customerID");
int goodsID=crs.getInt("goodsID");
int number=crs.getInt("number");
float primaryPrice=crs.getFloat("primaryPrice");
float bargainPrice=crs.getFloat("bargainPrice");
String creatTime=crs.getString("creatTime");
jTableHistory.setValueAt(customerId, i, 0);
jTableHistory.setValueAt(goodsID, i, 1);
jTableHistory.setValueAt(number, i, 2);
jTableHistory.setValueAt(primaryPrice, i, 3);
jTableHistory.setValueAt(bargainPrice, i, 4);
jTableHistory.setValueAt(creatTime, i, 5);
i++;
}
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
}
/**
* This method initializes jPanelGoods
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelGoods() {
if (jPanelGoods == null) {
jPanelGoods = new JPanel();
jPanelGoods.setLayout(null);
jPanelGoods.add(getJScrollPaneGoods(), null);
jPanelGoods.add(getJButtonDeleteOneGoods(), null);
}
return jPanelGoods;
}
/**
* This method initializes jScrollPaneGoods
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPaneGoods() {
if (jScrollPaneGoods == null) {
jScrollPaneGoods = new JScrollPane();
jScrollPaneGoods.setBounds(new Rectangle(8, 8, 415, 325));
jScrollPaneGoods.setViewportView(getJTableGoodsList());
}
return jScrollPaneGoods;
}
/**
* This method initializes jPanelPersonalInfo
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelPersonalInfo() {
if (jPanelPersonalInfo == null) {
jLabelAccount = new JLabel();
jLabelAccount.setBounds(new Rectangle(15, 284, 111, 23));
jLabelAccount.setText("帐户余额");
jLabelProfession = new JLabel();
jLabelProfession.setBounds(new Rectangle(14, 233, 110, 34));
jLabelProfession.setText("职业");
jLabelEmail = new JLabel();
jLabelEmail.setBounds(new Rectangle(17, 194, 103, 27));
jLabelEmail.setText("邮箱");
jLabelAddress = new JLabel();
jLabelAddress.setBounds(new Rectangle(11, 150, 109, 29));
jLabelAddress.setText("地址");
jLabelSex = new JLabel();
jLabelSex.setBounds(new Rectangle(12, 103, 108, 31));
jLabelSex.setText("性别");
jLabelRealName = new JLabel();
jLabelRealName.setBounds(new Rectangle(13, 64, 103, 26));
jLabelRealName.setText("真实姓名");
jLabelName = new JLabel();
jLabelName.setBounds(new Rectangle(14, 20, 103, 26));
jLabelName.setText("用户名");
jPanelPersonalInfo = new JPanel();
jPanelPersonalInfo.setLayout(null);
jPanelPersonalInfo.add(jLabelName, null);
jPanelPersonalInfo.add(getJTextFieldName(), null);
jPanelPersonalInfo.add(jLabelRealName, null);
jPanelPersonalInfo.add(getJTextFieldRealName(), null);
jPanelPersonalInfo.add(jLabelSex, null);
jPanelPersonalInfo.add(jLabelAddress, null);
jPanelPersonalInfo.add(jLabelEmail, null);
jPanelPersonalInfo.add(jLabelProfession, null);
jPanelPersonalInfo.add(jLabelAccount, null);
jPanelPersonalInfo.add(getJTextFieldAddress(), null);
jPanelPersonalInfo.add(getJTextFieldEmail(), null);
jPanelPersonalInfo.add(getJTextFieldProfession(), null);
jPanelPersonalInfo.add(getJButtonSubmit(), null);
jPanelPersonalInfo.add(getJButtonCancle(), null);
jPanelPersonalInfo.add(getJTextFieldAccount(), null);
jPanelPersonalInfo.add(getJRadioButtonMale(), null);
jPanelPersonalInfo.add(getJRadioButtonFemal(), null);
}
return jPanelPersonalInfo;
}
/**
* This method initializes jTextFieldName
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldName() {
if (jTextFieldName == null) {
jTextFieldName = new JTextField();
jTextFieldName.setBounds(new Rectangle(136, 20, 160, 31));
}
return jTextFieldName;
}
/**
* This method initializes jTextFieldRealName
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldRealName() {
if (jTextFieldRealName == null) {
jTextFieldRealName = new JTextField();
jTextFieldRealName.setBounds(new Rectangle(137, 63, 160, 27));
}
return jTextFieldRealName;
}
/**
* This method initializes jTextFieldAddress
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldAddress() {
if (jTextFieldAddress == null) {
jTextFieldAddress = new JTextField();
jTextFieldAddress.setBounds(new Rectangle(139, 147, 157, 30));
}
return jTextFieldAddress;
}
/**
* This method initializes jTextFieldEmail
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldEmail() {
if (jTextFieldEmail == null) {
jTextFieldEmail = new JTextField();
jTextFieldEmail.setBounds(new Rectangle(138, 194, 159, 34));
}
return jTextFieldEmail;
}
/**
* This method initializes jTextFieldProfession
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldProfession() {
if (jTextFieldProfession == null) {
jTextFieldProfession = new JTextField();
jTextFieldProfession.setBounds(new Rectangle(139, 238, 155, 30));
}
return jTextFieldProfession;
}
/**
* This method initializes jButtonSubmit
*
* @return javax.swing.JButton
*/
private JButton getJButtonSubmit() {
if (jButtonSubmit == null) {
jButtonSubmit = new JButton();
jButtonSubmit.setBounds(new Rectangle(35, 330, 114, 39));
jButtonSubmit.setText("提交");
jButtonSubmit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
String Msg=ConstanValue.MSG_UPDATE_INFO_PERSONAL;
try{
String name=jTextFieldName.getText().trim();
String realname=jTextFieldRealName.getText().trim();
String address=jTextFieldAddress.getText().trim();
String email=jTextFieldEmail.getText().trim();
String profession=jTextFieldProfession.getText().trim();
float account=Float.parseFloat(jTextFieldAccount.getText().trim());
String sex=group.getSelection().getActionCommand();
os.writeObject(Msg);
os.writeObject(realname);
os.writeObject(sex);
os.writeObject(profession);
os.writeObject(address);
os.writeObject(email);
os.writeFloat(account);
os.flush();
System.out.println("finish");
Msg=(String)is.readObject();
JOptionPane.showMessageDialog(null, Msg);
//setVisible(false);
jTabbedPane.setSelectedIndex(0);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
});
}
return jButtonSubmit;
}
/**
* This method initializes jButtonCancle
*
* @return javax.swing.JButton
*/
private JButton getJButtonCancle() {
if (jButtonCancle == null) {
jButtonCancle = new JButton();
jButtonCancle.setBounds(new Rectangle(196, 336, 115, 32));
jButtonCancle.setText("取消");
}
return jButtonCancle;
}
/**
* This method initializes jTextFieldAccount
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldAccount() {
if (jTextFieldAccount == null) {
jTextFieldAccount = new JTextField();
jTextFieldAccount.setBounds(new Rectangle(141, 276, 154, 30));
}
return jTextFieldAccount;
}
/**
* This method initializes jRadioButtonMale
*
* @return javax.swing.JRadioButton
*/
private JRadioButton getJRadioButtonMale() {
if (jRadioButtonMale == null) {
jRadioButtonMale = new JRadioButton();
jRadioButtonMale.setBounds(new Rectangle(140, 107, 112, 26));
jRadioButtonMale.setText("男");
jRadioButtonMale.setActionCommand("男");
group.add(jRadioButtonMale);
}
return jRadioButtonMale;
}
/**
* This method initializes jRadioButtonFemal
*
* @return javax.swing.JRadioButton
*/
private JRadioButton getJRadioButtonFemal() {
if (jRadioButtonFemal == null) {
jRadioButtonFemal = new JRadioButton();
jRadioButtonFemal.setBounds(new Rectangle(257, 103, 109, 35));
jRadioButtonFemal.setText("女");
jRadioButtonFemal.setActionCommand("男");
group.add(jRadioButtonFemal);
}
return jRadioButtonFemal;
}
/**
* This method initializes jPanelHistory
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelHistory() {
if (jPanelHistory == null) {
jPanelHistory = new JPanel();
jPanelHistory.setLayout(null);
jPanelHistory.add(getJScrollPaneHistory(), null);
jPanelHistory.add(getJButtonClear(), null);
}
return jPanelHistory;
}
/**
* This method initializes jScrollPaneHistory
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPaneHistory() {
if (jScrollPaneHistory == null) {
jScrollPaneHistory = new JScrollPane();
jScrollPaneHistory.setBounds(new Rectangle(14, 19, 404, 260));
jScrollPaneHistory.setViewportView(getJTableHistory());
}
return jScrollPaneHistory;
}
/**
* This method initializes jTableHistory
*
* @return javax.swing.JTable
*/
private JTable getJTableHistory() {
if (jTableHistory == null) {
MyBilltableModel MyModel=new MyBilltableModel();
jTableHistory = new JTable(MyModel);
}
return jTableHistory;
}
/**
* This method initializes jButtonClear
*
* @return javax.swing.JButton
*/
private JButton getJButtonClear() {
if (jButtonClear == null) {
jButtonClear = new JButton();
jButtonClear.setBounds(new Rectangle(18, 319, 121, 39));
jButtonClear.setText("清空");
}
return jButtonClear;
}
/**
* This method initializes jPanelMessageBoard
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelMessageBoard() {
if (jPanelMessageBoard == null) {
jPanelMessageBoard = new JPanel();
jPanelMessageBoard.setLayout(null);
jPanelMessageBoard.add(getJButtonRemoveAll(), null);
jPanelMessageBoard.add(getJScrollPaneMessage(), null);
}
return jPanelMessageBoard;
}
/**
* This method initializes jButtonRemoveAll
*
* @return javax.swing.JButton
*/
private JButton getJButtonRemoveAll() {
if (jButtonRemoveAll == null) {
jButtonRemoveAll = new JButton();
jButtonRemoveAll.setBounds(new Rectangle(16, 335, 151, 46));
jButtonRemoveAll.setText("清空留言板");
}
return jButtonRemoveAll;
}
/**
* This method initializes jScrollPaneMessage
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPaneMessage() {
if (jScrollPaneMessage == null) {
jScrollPaneMessage = new JScrollPane();
jScrollPaneMessage.setBounds(new Rectangle(7, 9, 411, 323));
jScrollPaneMessage.setViewportView(getJTextAreaMessage());
}
return jScrollPaneMessage;
}
/**
* This method initializes jTextAreaMessage
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextAreaMessage() {
if (jTextAreaMessage == null) {
jTextAreaMessage = new JTextArea();
jTextAreaMessage.setEditable(false);
}
return jTextAreaMessage;
}
/**
* This method initializes jButtonAddOneGoods
*
* @return javax.swing.JButton
*/
/* private JButton getJButtonAddOneGoods() {
if (jButtonAddOneGoods == null) {
jButtonAddOneGoods = new JButton();
jButtonAddOneGoods.setBounds(new Rectangle(371, 128, 164, 37));
jButtonAddOneGoods.setText("添加一种商品");
}
return jButtonAddOneGoods;
}
*/
/**
* This method initializes jButtonEditOneGoods
*
* @return javax.swing.JButton
*/
/*private JButton getJButtonEditOneGoods() {
if (jButtonEditOneGoods == null) {
jButtonEditOneGoods = new JButton();
jButtonEditOneGoods.setBounds(new Rectangle(372, 193, 165, 35));
jButtonEditOneGoods.setText("修改选中的商品的信息");
}
return jButtonEditOneGoods;
}
*/
} // @jve:decl-index=0:visual-constraint="10,10"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -