package view; import java.awt.Font; import javax.swing.JButton; public class PayFrame extends MyFrame{ public PayFrame() { super("支付方式", 400,230); this.tubiao(); getContentPane().setLayout(null); JButton btnWeChat =new JButton(); btnWeChat.setText("微信支付"); btnWeChat.setFont(new Font("微软雅黑",Font.PLAIN,15)); btnWeChat.setBounds(120, 50, 150, 30); getContentPane().add(btnWeChat); JButton btnAlipay =new JButton(); btnAlipay.setText("支付宝支付"); btnAlipay.setFont(new Font("微软雅黑",Font.PLAIN,15)); btnAlipay.setBounds(120, 100, 150, 30); getContentPane().add(btnAlipay); //btnUser的的ActionEvent事件监听器 btnWeChat.addActionListener(e->{ WeChatPay w=new WeChatPay("微信支付", 476, 650); w.setVisible(true); setVisible(false); }); //btnRider的的ActionEvent事件监听器 btnAlipay.addActionListener(e->{ Alipay a=new Alipay("支付宝支付", 574, 650); a.setVisible(true); setVisible(false); }); } private void tubiao() { // TODO 自动生成的方法存根 MyFrame.setTitleImage(this,"4.png" ); MyFrame.setBackgroundImage(this,"3.jpg"); } }