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

📄 resume.java

📁 个人简历的小程序.Windows形式.简单,初学者易明.
💻 JAVA
字号:
//Resume.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Resume extends WindowAdapter implements ActionListener,ItemListener
{Frame win1=new Frame("个人简历");
 TextField tf1=new TextField(30);
 CheckboxGroup cbg=new CheckboxGroup();
 Checkbox man=new Checkbox("男",cbg,true),
          girl=new Checkbox("女",cbg,false);
 TextField tf2=new TextField("YYYY-MM",7);
 TextField tf3=new TextField(10);
 TextField tf4=new TextField(30);
 TextField tf5=new TextField(20);
 String subject[]={"篮球","足球","游泳","音乐","阅读","电脑"};
 Checkbox cb[]=new Checkbox[6];
 Choice c=new Choice();
 TextArea ta1=new TextArea(null,3,50);
 Button b1=new Button("提交");
 Button b2=new Button("重填");
 String output;
 Resume()
 {win1.setLayout(new GridLayout(12,1,0,0));
  win1.addWindowListener(this);
  Panel p1=new Panel();
  p1.setLayout(new FlowLayout(FlowLayout.CENTER));
  p1.add(new Label("个人简历"));
  win1.add(p1);
  Panel p2=new Panel();
  p2.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p2);
  p2.add(new Label("姓名:"));
  p2.add(tf1);
  tf1.addActionListener(this);
  Panel p3=new Panel();
  p3.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p3);
  p3.add(new Label("性别:"));
  p3.add(man);
  p3.add(girl);
  man.addItemListener(this);
  girl.addItemListener(this);
  Panel p4=new Panel();
  p4.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p4);
  p4.add(new Label("出生年月:"));
  p4.add(tf2);
  tf2.addActionListener(this);
  Panel p5=new Panel();
  p5.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p5);
  p5.add(new Label("籍贯:"));
  p5.add(tf3);
  tf3.addActionListener(this);
  Panel p6=new Panel();
  p6.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p6);
  p6.add(new Label("住址:"));
  p6.add(tf4);
  tf4.addActionListener(this);
  Panel p7=new Panel();
  p7.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p7);
  p7.add(new Label("电话:"));
  p7.add(tf5);
  tf5.addActionListener(this);
  Panel p8=new Panel();
  p8.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p8);
  p8.add(new Label("个人爱好:"));
  for(int i=0;i<6;i++)
   {cb[i]=new Checkbox(subject[i]);
    p8.add(cb[i]);
    cb[i].addItemListener(this);}
  Panel p9=new Panel();
  p9.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p9);
  p9.add(new Label("教育程度:"));
   c.add("博士");
   c.add("硕士");
   c.add("本科");
   c.add("大专");
   c.add("高中");
   p9.add(c);
  c.addItemListener(this);
  Panel p10=new Panel();
  p10.setLayout(new FlowLayout(FlowLayout.LEFT));
  win1.add(p10);
  p10.add(new Label("个人介绍:"));
  Panel p11=new Panel();
  win1.add(p11);
  p11.add(ta1);
  Panel p12=new Panel();
  win1.add(p12);
  p12.add(b1);
  p12.add(b2); 
  b1.addActionListener(this);
  b2.addActionListener(this);
  win1.setSize(400,500);
  win1.setVisible(true);
 }
 public static void main(String[] args)
  {new Resume();}
 public void windowClosing(WindowEvent e)
  {System.exit(0);}
 public void itemStateChanged(ItemEvent e)
  {e.getItem();  
  }
 public void actionPerformed(ActionEvent e)
  {if(e.getSource()==b1)
   {output="姓名:"+tf1.getText()+"\n";
    output+="性别:"+cbg.getSelectedCheckbox().getLabel()+"\n";
    output+="出生年月:"+tf2.getText()+"\n";
    output+="籍贯:"+tf3.getText()+"\n";
    output+="地址:"+tf4.getText()+"\n";
    output+="电话:"+tf5.getText()+"\n";
    output+="个人爱好:";
    for(int i=0;i<6;i++)
     {if(cb[i].getState())
      output+=","+cb[i].getLabel();
      }
    output+="\n";
    String xueli="";
    if(c.getSelectedItem()=="博士")
      xueli="博士";
    if(c.getSelectedItem()=="硕士")
      xueli="硕士";
    if(c.getSelectedItem()=="本科")
      xueli="本科";
    if(c.getSelectedItem()=="大专")
      xueli="大专";
    if(c.getSelectedItem()=="高中")
      xueli="高中";
    output+="教育程度:"+xueli+"\n";
    output+="个人介绍:"+ta1.getText();
    JOptionPane.showMessageDialog(null,output,"你的个人简历资料",JOptionPane.INFORMATION_MESSAGE);
   }
   if(e.getSource()==b2);
    {tf1.setText("");
     cbg.setSelectedCheckbox(man);
     tf2.setText("YYYY-MM");
     tf3.setText("");
     tf4.setText("");
     tf5.setText("");
     for(int i=0;i<6;i++)
      cb[i].setState(false);
     c.select(0);
     ta1.setText("");
    }
  }
}

⌨️ 快捷键说明

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