You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
3.9 KiB
126 lines
3.9 KiB
package com.tmj.view;
|
|
|
|
import java.awt.Component;
|
|
import java.awt.Font;
|
|
|
|
import javax.swing.JButton;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JOptionPane;
|
|
import javax.swing.JPasswordField;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.SwingConstants;
|
|
|
|
import com.tmj.dao.impl.AccounttmjImpl;
|
|
import com.tmj.dao.impl.MovietmjImpl;
|
|
import com.tmj.javaBean.Accounttmj;
|
|
import com.tmj.javaBean.Movietmj;
|
|
|
|
public class AddMovie extends MyFrame{
|
|
|
|
private JTextField txtCategory;
|
|
private JTextField txtProductid;
|
|
private JTextField txtCname;
|
|
private JTextField txtEname;
|
|
|
|
|
|
|
|
|
|
public AddMovie(String title, int width, int heigth) {
|
|
super(title, width, heigth);
|
|
|
|
getContentPane().setLayout(null);
|
|
|
|
JLabel categoryLabel=new JLabel();
|
|
categoryLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
categoryLabel.setBounds(51,33,83,30);
|
|
categoryLabel.setText("电影类型");
|
|
categoryLabel.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(categoryLabel);
|
|
|
|
txtCategory =new JTextField(10);
|
|
txtCategory.setText("电影类型");
|
|
txtCategory.setBounds(158,33,157,30);
|
|
txtCategory.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(txtCategory);
|
|
|
|
JLabel productidLabel=new JLabel();
|
|
productidLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
productidLabel.setBounds(51,66,83,30);
|
|
productidLabel.setText("电影编号");
|
|
productidLabel.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(productidLabel);
|
|
|
|
txtProductid =new JTextField(10);
|
|
txtProductid.setText("电影编号");
|
|
txtProductid.setBounds(158,66,157,30);
|
|
txtProductid.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(txtProductid);
|
|
|
|
JLabel cnameLabel=new JLabel();
|
|
cnameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
cnameLabel.setBounds(51,99,83,30);
|
|
cnameLabel.setText("电影中文名");
|
|
cnameLabel.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(cnameLabel);
|
|
|
|
txtCname =new JTextField(10);
|
|
txtCname.setText("电影中文名");
|
|
txtCname.setBounds(158,99,157,30);
|
|
txtCname.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(txtCname);
|
|
|
|
JLabel enameLabel=new JLabel();
|
|
enameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
enameLabel.setBounds(51,132,83,30);
|
|
enameLabel.setText("电影英文名");
|
|
enameLabel.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(enameLabel);
|
|
|
|
txtEname =new JTextField(10);
|
|
txtEname.setText("电影英文名");
|
|
txtEname.setBounds(158,132,157,30);
|
|
txtEname.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
getContentPane().add(txtEname);
|
|
|
|
|
|
JButton btnadd = new JButton();
|
|
btnadd.setText("添加");
|
|
btnadd.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
btnadd.setBounds(61,200,100,30);
|
|
getContentPane().add(btnadd);
|
|
|
|
JButton btnCancel = new JButton();
|
|
btnCancel.setText("返回上一层");
|
|
btnCancel.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
btnCancel.setBounds(225,200,100,30);
|
|
getContentPane().add(btnCancel);
|
|
|
|
btnadd.addActionListener(e->{
|
|
JLabel lf = new JLabel("添加成功");
|
|
lf.setFont(new Font("微软雅黑",Font.PLAIN,15));
|
|
JOptionPane.showMessageDialog(null, lf,"购票成功",JOptionPane.INFORMATION_MESSAGE);
|
|
String category=txtCategory.getText();
|
|
String movied=txtProductid.getText();
|
|
String cname=txtCname.getText();
|
|
String ename=txtEname.getText();
|
|
double sss=1;
|
|
double yyy=1;
|
|
Movietmj a2tmj=new Movietmj(category,movied,cname,ename,"images/img.jpg","1",sss,yyy);
|
|
MovietmjImpl actmj=new MovietmjImpl();
|
|
actmj.insert(a2tmj);
|
|
|
|
});
|
|
|
|
btnCancel.addActionListener(e->{
|
|
MovieListFrame plf =new MovieListFrame("电影列表",1000,700);
|
|
plf.setVisible(true);
|
|
setVisible(false);
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|