⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customerframe.java

📁 java编的销售系统
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class CustomerFrame extends JDialog
{
	private String CName = null;
	private String phone;
	private String addr;
	private String EID;
	private JTextField CNameP;
   	private JTextField phoneP;
   	private JTextField addrP;
  	private JTextField EIDP;
	
	public CustomerFrame(JFrame customer)
	{
		super(customer, "Fill customer information", true);
		setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);
		Container contentPane = getContentPane();
		
		
	
		
		JPanel panel = new JPanel();
		JLabel label = new JLabel("Welcome to order pizza by phone!"); //欢迎界面的欢迎


		panel.setFont(new Font("Georgia", Font.BOLD, 12)); //设置显示的字体
		panel.add(label); //将标签添加到面板jp1中
		
		
		JLabel label1= new JLabel("Please enter your detail information."); //输入提示输入


		panel.setFont(new Font("Georgia", Font.BOLD,12)); //设置显示的字体
		panel.add(label1);
        panel.setLayout(new GridLayout(6, 2));
      
      	panel.add(new JLabel("Name:"));
      	panel.add(CNameP = new JTextField(""));
      	panel.add(new JLabel("phone No.:"));
      	panel.add(phoneP = new JTextField(""));
      	panel.add(new JLabel("Address: "));
      	panel.add(addrP = new JTextField(""));
      	panel.add(new JLabel("Employee ID: "));
      	panel.add(EIDP = new JTextField(""));
      	contentPane.add(panel, BorderLayout.CENTER); 
      	
      	JPanel ButtonPanel = new JPanel();
      	JButton okButton = new JButton("SURE");
      	okButton.addActionListener(new
         	ActionListener()
         	{
            	public void actionPerformed(ActionEvent event)
            	{
               		CName = CNameP.getText();
               		phone = phoneP.getText();
               		addr = addrP.getText();
               		EID = EIDP.getText();
               		setVisible(false);
            	}
         	});

      	JButton cancelButton = new JButton("Cancel");
      	cancelButton.addActionListener(new
         	ActionListener()
         	{
            	public void actionPerformed(ActionEvent event)
            	{
               		setVisible(false);
            	}
         	});
         ButtonPanel.add(okButton);
         ButtonPanel.add(cancelButton);
         contentPane.add(ButtonPanel, BorderLayout.SOUTH);
         
         setSize(500, 300);
	}
	//返回信息
	public String getName()
	{
		return CName;
	}
	
	public String getPhone()
	{
		return phone;
	}
	
	public String getAddr()
	{
		return addr;
	}
	
	public String getEID()
	{
		return EID;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -