package ljb.ui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
import ljb.service.UserService;
import ljb.serviceIMP.*;
import ljb.ui.ChangePasswordWin.tianActionListener;
class GoodAdminWin extends JFrame
{
GoodInfo_Del_Win Delete=new GoodInfo_Del_Win();
GoodInfo_Up_Win Update=new GoodInfo_Up_Win();
JTabbedPane tp=new JTabbedPane();
GoodAdminWin(String s)
{
super(s);
tp.addTab("商品信息添加",Update);
tp.addTab("商品信修改与删除",Delete);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
dispose();
}
});
add(tp);
setBounds(405,310,700,400);
//setDefaultCloseOperation(3);
setResizable(false);
setVisible(true);
}
}
/*public class GoodInfo
{
public static void main(String args[])
{
new GoodAdminWin("商品管理");
}
}*/
class GoodInfo_Up_Win extends JPanel
{
JLabel l_goodnumber=new JLabel("商品编号"),
l_goodname=new JLabel("商品名称:"),
l_goodshort=new JLabel(" 简 称:"),
l_goodhome=new JLabel(" 产 地:"),
l_goodunit=new JLabel(" 单 位:"),
l_goodrule=new JLabel(" 规 格:"),
l_goodinterf=new JLabel(" 包 装:"),
l_goodnum=new JLabel(" 批 号:"),
l_goodpermit=new JLabel("批准文号:"),
l_applier=new JLabel("供应商人全称:"),
l_extra=new JLabel(" 备 注:",0);
JTextField t0=new JTextField("",20),
t1=new JTextField("",20),t2=new JTextField("",20),
t3=new JTextField("",20),t4=new JTextField("",10),
t5=new JTextField("",10),t6=new JTextField("",10),
t7=new JTextField("",10),t8=new JTextField("",20),
t10=new JTextField("",20);
Choice t9=new Choice();
JButton button=new JButton("添加");
Box basebox,box1,box2,box3,box4,box5,box6,basebox1,baseboxx,baseboxSide;
GoodInfo_Up_Win()
{
box1=Box.createVerticalBox();
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodnumber);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodname);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodshort);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodhome);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodunit);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodinterf);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodpermit);
box1.add(Box.createVerticalStrut(14));
box1.add(l_applier);
box1.add(Box.createVerticalStrut(14));
box1.add(l_extra);
box2=Box.createVerticalBox();
box2.add(t0);t0.addActionListener(new tianActionListener());
box2.add(Box.createVerticalStrut(8));
box2.add(t1);t1.addActionListener(new tianActionListener());
box2.add(Box.createVerticalStrut(8));
box2.add(t2);t2.addActionListener(new tianActionListener());
box2.add(Box.createVerticalStrut(8));
box2.add(t3);t3.addActionListener(new tianActionListener());
box3=Box.createVerticalBox();
box3.add(t4);t4.addActionListener(new tianActionListener());
box3.add(Box.createVerticalStrut(8));
box3.add(t5);t5.addActionListener(new tianActionListener());
box4=Box.createVerticalBox();
box4.add(l_goodrule);
box4.add(Box.createVerticalStrut(8));
box4.add(l_goodnum);
box5=Box.createVerticalBox();
box5.add(t6);t6.addActionListener(new tianActionListener());
box5.add(Box.createVerticalStrut(8));
box5.add(t7);t7.addActionListener(new tianActionListener());
basebox1=Box.createHorizontalBox();
basebox1.add(box3);
basebox1.add(Box.createHorizontalStrut(10));
basebox1.add(box4);
basebox1.add(Box.createHorizontalStrut(10));
basebox1.add(box5);
box6=Box.createVerticalBox();
box6.add(t8);t8.addActionListener(new tianActionListener());
box6.add(Box.createVerticalStrut(6));
box6.add(t9);
box6.add(Box.createVerticalStrut(6));
t9.add("蜗居人生");
t9.add("华谊兄弟");
t9.add("海尔集团");
t9.add("苏宁电器");
t9.add("联想电脑");
box6.add(Box.createVerticalStrut(6));
box6.add(t10);t10.addActionListener(new tianActionListener());
baseboxx=Box.createVerticalBox();
baseboxx.add(Box.createVerticalStrut(16));
baseboxx.add(box2);
baseboxx.add(Box.createVerticalStrut(14));
baseboxx.add(basebox1);
baseboxx.add(Box.createVerticalStrut(14));
baseboxx.add(box6);
baseboxSide=Box.createVerticalBox();
basebox=Box.createHorizontalBox();
basebox.add(baseboxSide);
basebox.add(Box.createHorizontalStrut(8));
basebox.add(box1);
basebox.add(Box.createHorizontalStrut(4));
basebox.add(baseboxx);
add(basebox);
add(button);button.addActionListener(new tianActionListener());
setLayout(new FlowLayout());
/*setBounds(320,160,450,355);
setDefaultCloseOperation(3);
setResizable(false);
setVisible(true);*/
}
class tianActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{UserService us=new UserServiceIMP();
boolean istrue=us.IsLoginSuccess(t0.getText(),t1.getText(),t2.getText(),t3.getText(),t4.getText(), t5.getText(),t6.getText(),t7.getText(),t8.getText(),t9.getSelectedItem(),t10.getText());
if(istrue)
{System.out.println("success");
t0.setText(null);t1.setText(null);t2.setText(null);
t3.setText(null);t4.setText(null);t5.setText(null);
t6.setText(null);t7.setText(null);t8.setText(null);
t10.setText(null);
}
else
System.out.println("failure");
}
}
}
class GoodInfo_Del_Win extends JPanel
{
JLabel l_goodname=new JLabel("商品名称:"),
l_goodnumber=new JLabel("商品编号:"),
l_goodshort=new JLabel(" 简 称:"),
l_goodhome=new JLabel(" 产 地:"),
l_goodunit=new JLabel(" 单 位:"),
l_goodrule=new JLabel(" 规 格:"),
l_goodinterf=new JLabel(" 包 装:"),
l_goodnum=new JLabel(" 批 号:"),
l_goodpermit=new JLabel("批准文号:"),
l_applier=new JLabel("供应商人全称:"),
l_extra=new JLabel(" 备 注:",0);
JTextField t0=new JTextField("",20),
t1=new JTextField("",20),t2=new JTextField("",20),
t3=new JTextField("",20),t4=new JTextField("",10),
t5=new JTextField("",10),t6=new JTextField("",10),
t7=new JTextField("",10),t8=new JTextField("",20),
t10=new JTextField("",20);
Choice t9=new Choice();
JButton buttonX=new JButton("修改"),buttonS=new JButton("删除");
Box basebox,box1,box2,box3,box4,box5,box6,basebox1,baseboxx,baseboxSide;
GoodInfo_Del_Win()
{
box1=Box.createVerticalBox();
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodnumber);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodname);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodshort);
box1.add(Box.createVerticalStrut(14));
box1.add(l_goodhome);
box1.add(Box.createVertica