50faa6601b4f001d1dfab05036c3dc79

来自「学生管理系统.对学生信息管理的一个应用软件!」· 代码 · 共 89 行

TXT
89
字号
import java .awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.Box;
class Mypanel1 extends Panel implements ActionListener
{  Box baseBox,boxV1,boxV2;
   Label nameLabel,noLabel,classLabel;
   TextField nameText,noText,classText;
   Button sureButton;
   Mypanel1(String s)
   {    nameLabel=new Label("姓名",Label.LEFT);
	    noLabel=new Label("学号",Label.LEFT);
	    classLabel=new Label("班级",Label.LEFT);
	    nameText=new TextField(10);
	    noText=new TextField(10);
	    classText=new TextField(10);
	    sureButton=new Button("确定");
	    
	    boxV1=Box.createVerticalBox();
		boxV1.add(nameLabel);
	    boxV1.add(Box.createVerticalStrut(18));
	    boxV1.add(noLabel);
	    boxV1.add(Box.createVerticalStrut(18));
	    boxV1.add(classLabel);
	    
	    boxV2=Box.createVerticalBox();
		boxV2.add(nameText);
	    boxV2.add(Box.createVerticalStrut(18));
	    boxV2.add(noText);
	    boxV2.add(Box.createVerticalStrut(18));
	    boxV2.add(classText);
		  
	    
	    baseBox=Box.createHorizontalBox();
	    baseBox.add(boxV1);
	    baseBox.add(boxV2);
		add(baseBox);
		add(sureButton);
		  
	    nameText.addActionListener(this);
	    noText.addActionListener(this);
	    classText.addActionListener(this); 
	    sureButton.addActionListener(this);
        setBounds(120,120,300,300);
        setVisible(true);
        validate();
	    
   }


public void actionPerformed(ActionEvent e)
   {
	   
   }
	
}

/*class searchWindow extends Frame implements ActionListener
{  Button sureButton;
   Mypanel1 panel1;
   searchWindow(String s)
   {   super(s);
       setLayout(new FlowLayout());
	   panel1=new Mypanel1();
	   add(panel1);
       addWindowListener(new WindowAdapter()
    		          {  public void windowClosing(WindowEvent e)
                         {  System.exit(0);
                         }
    		          });
       setBounds(120,120,300,300);
       setVisible(true);
       validate();
    }
   public void actionPerformed(ActionEvent e)
   {   
	   
   }
	
}*/

public class searchMen
{   public static void main(String args[])
   { Mypanel1 win=new Mypanel1("人员信息查询");
	
   }
}

⌨️ 快捷键说明

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