📄 soft.java
字号:
import java.awt.*;
import java.util.*;
import java.net.*;
import java.awt.event.*;
import java.applet.*;
class myframe extends Frame implements ActionListener
{
String daimas[]=new String[20],
names[]=new String[20],
nums[]=new String[20],
peoples[]=new String[20],
riqis[]=new String[20];
int i=5;
Image bg;
Button bt1,bt2,bt3,bt4,bt5,bt6;
TextField daima,name,num,people,riqi;
URL pos;
TextArea t1=new TextArea (null,18,120,TextArea.SCROLLBARS_BOTH);
public myframe()
{
t1.append("daimas"+"\t"+"\t"+"\t"+"names"+"\t"+"\t"+"\t"+"nums"+"\t"+"\t"+"\t"+"people"+"\t"+"\t"+"\t"+"riqis"+"\n");
//----------------chushiwenjian
names[0]="shuju";
names[1]="lisan";
names[2]="gaoshu";
names[3]="english";
names[4]="modian";
names[5]="shuluo";
daimas[0]="00001";
daimas[1]="00002";
daimas[2]="00003";
daimas[3]="00004";
daimas[4]="00005";
daimas[5]="00006";
nums[0]="100";
nums[1]="100";
nums[2]="100";
nums[3]="100";
nums[4]="100";
nums[5]="100";
for(int j=0;j<=i;++j)
{
peoples[j]="renguoli";
riqis[j]="2004-10-11";
}
//Frame f=new Frame("库房管理系统");
Panel p1,p2,p21,p22,p3,p4,p5,p6;
Label l1,l2,l3,l4,l5,l6,l7;
//TextArea t1=new TextArea (null,5,30,TextArea.SCROLLBARS_BOTH);
TextArea t2=new TextArea (null,5,30,TextArea.SCROLLBARS_BOTH);
l1=new Label("the system of cangku-renguoli");
l2=new Label("chukuquyu",Label.CENTER);
l3=new Label("daima");
l4=new Label("name");
l5=new Label("num");
l6=new Label("people");
l7=new Label("riqi");
daima=new TextField(20);
//daima.addTextListener(this);
name=new TextField(20);
num=new TextField(20);
people=new TextField(20);
riqi=new TextField(20);
setLayout(new BorderLayout());
//---------------------------------------------
p1=new Panel();
p2=new Panel();
p3=new Panel();
p4=new Panel();
p5=new Panel();
p6=new Panel();
p21=new Panel();
p22=new Panel();
//------------------------------------------------
bt1=new Button("queren");
bt1.addActionListener(this);
bt2=new Button("chaxun");
bt2.addActionListener(this);
bt3=new Button("chaxun");
bt3.addActionListener(this);
bt2.setSize(20,10);
//--------------------------------------------
p1.setBackground(Color.BLUE);
//---------------------------------------
p2.setBackground(Color.RED);
p2.setLayout(new GridLayout(6,1));
p2.add(l2);
p2.add(bt1);
p2.add(bt2);
p2.add(bt3);
//------------------------------------------
p3.setBackground(Color.YELLOW);
p3.add(t1);
//----------------------------------------------
p4.setBackground(Color.GRAY);
p4.setLayout(new GridLayout(10,1));
p4.add(l3);
p4.add(daima);
p4.add(l4);
p4.add(name);
p4.add(l5);
p4.add(num);
p4.add(l6);
p4.add(people);
p4.add(l7);
p4.add(riqi);
//p4.add(t2);
//---------------------------------------------
p5.setBackground(Color.GREEN);
p5.add(l1);
//------------------------------------------------
p6.setBackground(Color.BLUE);
//-------------------------------------------
setSize(400,300);
add(p1,BorderLayout.CENTER);
add(p2,BorderLayout.WEST);
add(p5,BorderLayout.NORTH);
add(p6,BorderLayout.EAST);
//p5.add(bt2);
p1.setLayout(new GridLayout(2,1));
//p5.setLayout(new GridLayout(1,3));
//p5.setSize(30,10);
//p1.add(p5);
//
p5.setLocation(50,50);
p1.add(p3);
p1.add(p4);
//*********************************************
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
show();
//f.pack();
//f.setVisible(true);
}
//************************************
//************************************************
public void actionPerformed(ActionEvent e)
{
//-----------------------------------------------
/*JOptionPane.showMessageDialog(this,"数字输入完全了吗???","提示对话框",JOptionPane.WARNING_MESSAGE);
try{x1=Integer.parseInt(t1.getText());}
catch(NumberFormatException ee)
{
x1=0;
}
try{x2=Integer.parseInt(t2.getText());}
catch(NumberFormatException ee)
{
x2=0;
}*/
if(e.getSource()==bt1)
{
//t1.append("daimas"+"\t"+"\t"+"\t"+"names"+"\t"+"\t"+"\t"+"nums"+"\t"+"\t"+"\t"+"people"+"\t"+"\t"+"\t"+"riqis"+"\n");
daimas[i+1]=daima.getText();
names[i+1]=name.getText();
nums[i+1]=num.getText();
peoples[i+1]=people.getText();
riqis[i+1]=riqi.getText();
t1.append(daimas[i+1]+"\t"+"\t"+"\t"+names[i+1]+"\t"+"\t"+"\t"+nums[i+1]+"\t"+"\t"+"\t"+peoples[i+1]+"\t"+"\t"+"\t"+riqis[i+1]+"\n");
++i;
};
if(e.getSource()==bt2)
{
for(int k=0;k<=i;++k)
{
t1.append(daimas[k]+"\t"+"\t"+"\t"+names[k]+"\t"+"\t"+"\t"+nums[k]+"\t"+"\t"+"\t"+peoples[k]+"\t"+"\t"+"\t"+riqis[k]+"\n");}
}
if(e.getSource()==bt3)
{
t1.setText("");
t1.append("daimas"+"\t"+"\t"+"\t"+"names"+"\t"+"\t"+"\t"+"nums"+"\t"+"\t"+"\t"+"people"+"\t"+"\t"+"\t"+"riqis"+"\n");
}
}
}
/*class churuku extends myframe
{
public void chuku()
{
//s[1]=s[1].concat(daimas);
//s[1].insert(9,names);
}
}*/
public class soft
{
public static void main(String args[])
{
new myframe();
//chuku();
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -