yonghu1.java
来自「JAVA小游戏。双人五子棋。需先下载编译器。」· Java 代码 · 共 284 行
JAVA
284 行
//简历程序
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//import javax.swing.JOptionPane;
public class YongHu1 extends WindowAdapter implements WindowListener,ActionListener
{
String output[][]=new String[50][10];
int i,j;
Frame fr=new Frame("first windows");
//Frame fr2=new Frame("second windows");
Label l1=new Label("姓名:");
Label l2=new Label("性别:");
Label l3=new Label("出生年月:");
Label l4=new Label("学历:");
Label l5=new Label("爱好:");
Label l6=new Label("籍贯:");
Label l7=new Label("其他:");
Choice c=new Choice();
CheckboxGroup cb1=new CheckboxGroup();
Checkbox cx1=new Checkbox("男",cb1,true);
Checkbox cx2=new Checkbox("女",cb1,false);
Checkbox c1=new Checkbox("电脑");
Checkbox c2=new Checkbox("音乐");
Checkbox c3=new Checkbox("美术");//20
Checkbox c4=new Checkbox("文学");
TextField tf1=new TextField(20);
TextField tf2=new TextField(20);
TextField tf3=new TextField(20);
TextArea tf4=new TextArea(null,6,40);
TextArea tf5=new TextArea(null,9,40);
Button b1=new Button("提交");
Button b2=new Button("重填");
//Button b3=new Button("查找");
//Button b4=new Button("上一层");
Button b5=new Button("下一条");
Button b6=new Button("上一条");
YongHu1()
{
GridLayout layout=new GridLayout(9,1);
//setLayout(layout);
fr.setLayout(new FlowLayout(FlowLayout.LEFT));
//fr2.setLayout(new FlowLayout());
fr.add(l1);
fr.add(tf1);
fr.add(l2);
fr.add(cx1);
fr.add(cx2);
fr.add(l3);
fr.add(tf2);
fr.add(l4);
c.addItem("中专");
c.addItem("高中");
c.addItem("大专");
c.addItem("本科");
c.addItem("硕士");
c.addItem("博士");
fr.add(c);
fr.add(l5);
fr.add(c1);
//c1.addItemListener(this);
fr.add(c2);
//c2.addItemListener(this);
fr.add(c3);
//c3.addItemListener(this);
fr.add(c4);
//c4.addItemListener(this);
fr.add(l6);
fr.add(tf3);
fr.add(tf4);
fr.add(b1);
b1.addActionListener(this);
fr.add(b2);
b2.addActionListener(this);
fr.add(b5);
b5.addActionListener(this);
fr.add(b6);
b6.addActionListener(this);
//fr.add(b3);
//b3.addActionListener(this);
fr.setSize(600,300);
fr.setVisible(true);
fr.addWindowListener(this);
//b4.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
//while(i<=output.length)
{
output[i][0]=tf1.getText();
output[i][1]=(cx1.getState()?"男":"女");
output[i][2]=tf2.getText();
output[i][3]=(c.getSelectedItem());
output[i][4]=(c1.getState()?"电脑":"");
output[i][5]=(c2.getState()?"音乐":"");
output[i][6]=(c3.getState()?"美术":"");
output[i][7]=(c4.getState()?"文学":"");
output[i][8]=(tf3.getText());
output[i][9]=(tf4.getText());
i++;
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
cx1.setState(true);
c1.setState(false);
c2.setState(false);
c3.setState(false);
c4.setState(false);
c.select(0);
}
}
if(e.getSource()==b2)
{
tf1.setText("");
tf2.setText("");
tf3.setText("");
tf4.setText("");
cx1.setState(true);
c1.setState(false);
c2.setState(false);
c3.setState(false);
c4.setState(false);
c.select(0);
}
if(e.getSource()==b5)
{
//while(i<=output.length)
{
//i=0;
tf1.setText(output[i][0]);
if(output[i][1]=="男")
{
cx1.setState(true);
cx2.setState(false);
}
else
{
cx2.setState(true);
cx1.setState(false);
}
tf2.setText(output[i][2]);
c.select(output[i][3]);
if(output[i][4]=="电脑")
{
c1.setState(true);
}
else
{
c1.setState(false);
}
if(output[i][5]=="音乐")
{
c2.setState(true);
}
else
{
c2.setState(false);
}
if(output[i][6]=="美术")
{
c3.setState(true);
}
else
{
c3.setState(false);
}
if(output[i][7]=="文学")
{
c4.setState(true);
}
else
{
c4.setState(false);
}
tf3.setText(output[i][8]);
tf4.setText(output[i][9]);
i++;
if(i==output.length-1)
{
i=0;
}
}
}
else if(e.getSource()==b6)
{
//while(i>=0)
{
//i=output.length;
tf1.setText(output[i][0]);
if(output[i][1]=="男")
{
cx1.setState(true);
cx2.setState(false);
}
else
{
cx2.setState(true);
cx1.setState(false);
}
tf2.setText(output[i][2]);
c.select(output[i][3]);
if(output[i][4]=="电脑")
{
c1.setState(true);
}
else
{
c1.setState(false);
}
if(output[i][5]=="音乐")
{
c2.setState(true);
}
else
{
c2.setState(false);
}
if(output[i][6]=="美术")
{
c3.setState(true);
}
else
{
c3.setState(false);
}
if(output[i][7]=="文学")
{
c4.setState(true);
}
else
{
c4.setState(false);
}
tf3.setText(output[i][8]);
tf4.setText(output[i][9]);
i--;
if(i==-1)
{
i=1;
}
}
}
}
public static void main(String args[])
{
new YongHu1();
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
//public void windowOpened(WindowEvent e){}
//public void windowClosed(WindowEvent e){}
//public void windowActivated(WindowEvent e){}
//public void windowDeactivated(WindowEvent e){}
//public void windowDeiconified(WindowEvent e){}
//public void windowIconified(WindowEvent e){}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?