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

📄 mgp.java

📁 Java的一个程序
💻 JAVA
字号:
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.awt.event.*;
class Gg extends Frame implements ActionListener
{   Box baseBox,box1;
	Label l1,l2;
    TextField  t1,t2;
	Button Zxfs,Jxfs;
	Gg(String s)
    {   
		super(s); 
        box1=Box.createVerticalBox();
		l1=new Label("请选择购票方式",Label.CENTER);
		l1.setBackground(Color.cyan);
        box1.add(l1);
        box1.add(Box.createVerticalStrut(10));

		Zxfs=new Button("自选");
        Zxfs.addActionListener(this);
        Zxfs.setBackground(Color.yellow);
        box1.add(Zxfs);
        box1.add(Box.createVerticalStrut(10));

        Jxfs=new Button("机选");
        Jxfs.addActionListener(this);
        Jxfs.setBackground(Color.yellow);
        box1.add(Jxfs);
        box1.add(Box.createVerticalStrut(10));
        
	    l2=new Label("购票日期",Label.CENTER);
        l2.setBackground(Color.yellow);
        box1.add(l2);
        box1.add(Box.createVerticalStrut(10));

        t2=new TextField(10);
        box1.add(t2);
        box1.add(Box.createVerticalStrut(10));
	
       baseBox=Box.createHorizontalBox();
       baseBox.add(box1);
	   baseBox.add(Box.createHorizontalStrut(10));
	  
	   setLayout(new FlowLayout());
	   add(baseBox);
	   setBackground(Color.pink);
	   setBounds(120,150,250,180);
       addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				 setVisible(false);
			}
		});
   setVisible(true);
	}
	public void actionPerformed(ActionEvent e)
	{
	if(e.getSource()==Zxfs)
		{Hh j=new Hh("欢迎使用自选方式");
	}
	else if(e.getSource()==Jxfs){Rr p=new Rr("欢迎使用机选方式");}
	}
}
public class Mgp
{
	public static void main(String args[])
	{
		Gg caipiao=new Gg("彩民购票界面");
	}
}

⌨️ 快捷键说明

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