简单个人简历java录入程序 代码

栏目:资讯发布:2023-10-04浏览:2收藏

简单个人简历java录入程序 代码,第1张

我帮你写了那些JAVA代码了,效果包你满意!呵呵……

至于网页的代码嘛,这里就不贴了。你要的话HI我吧^_^。

JAVA代码如下:

import javaawtBorderLayout;

import javaxswing;

import javaawtDimension;

import javaawtRectangle;

public class MyLuRu extends JFrame {

 private static final long serialVersionUID = 1L;

 private JPanel jContentPane = null;

 private JLabel jLabel = null;

 private JLabel jLabel1 = null;

 private JLabel jLabel2 = null;

 private JLabel jLabel3 = null;

 private JTextField jTextField = null;

 private JRadioButton jRadioButton = null;

 private JRadioButton jRadioButton1 = null;

 private JComboBox jComboBox = null;

 private JComboBox jComboBox1 = null;

 private JButton jButton = null;

 private JButton jButton1 = null;

 private JTextArea jTextArea = null;

 private ButtonGroup mybg=new ButtonGroup();

 /

   This is the default constructor

  /

 public MyLuRu() {

  super();

  initialize();

 }

 /

   This method initializes this

   

   @return void

  /

 private void initialize() {

  thissetSize(268, 407);

  thissetContentPane(getJContentPane());

  thissetTitle("录入");

  thisaddWindowListener(new javaawteventWindowAdapter() {

   public void windowClosing(javaawteventWindowEvent e) {

    Systemexit(0);

   }

  });

  thissetVisible(true);

 }

 /

   This method initializes jContentPane

   

   @return javaxswingJPanel

  /

 private JPanel getJContentPane() {

  if (jContentPane == null) {

   jLabel3 = new JLabel();

   jLabel3setBounds(new Rectangle(16, 150, 65, 18));

   jLabel3setText("文化程度:");

   jLabel2 = new JLabel();

   jLabel2setBounds(new Rectangle(16, 108, 39, 18));

   jLabel2setText("专业:");

   jLabel1 = new JLabel();

   jLabel1setBounds(new Rectangle(16, 66, 39, 18));

   jLabel1setText("性别:");

   jLabel = new JLabel();

   jLabelsetBounds(new Rectangle(16, 24, 39, 18));

   jLabelsetText("姓名:");

   jContentPane = new JPanel();

   jContentPanesetLayout(null);

   jContentPaneadd(jLabel, null);

   jContentPaneadd(jLabel1, null);

   jContentPaneadd(jLabel2, null);

   jContentPaneadd(jLabel3, null);

   jContentPaneadd(getJTextField(), null);

   jContentPaneadd(getJRadioButton(), null);

   jContentPaneadd(getJRadioButton1(), null);  

   mybgadd(jRadioButton);

   mybgadd(jRadioButton1);

   jContentPaneadd(getJComboBox(), null);

   jContentPaneadd(getJComboBox1(), null);

   jContentPaneadd(getJButton(), null);

   jContentPaneadd(getJButton1(), null);

   jContentPaneadd(getJTextArea(), null);   

  }

  return jContentPane;

 }

 /

   This method initializes jTextField 

    

   @return javaxswingJTextField 

  /

 private JTextField getJTextField() {

  if (jTextField == null) {

   jTextField = new JTextField();

   jTextFieldsetBounds(new Rectangle(61, 24, 180, 18));

  }

  return jTextField;

 }

 /

   This method initializes jRadioButton 

    

   @return javaxswingJRadioButton 

  /

 private JRadioButton getJRadioButton() {

  if (jRadioButton == null) {

   jRadioButton = new JRadioButton();

   jRadioButtonsetBounds(new Rectangle(61, 62, 38, 26));

   jRadioButtonsetText("男");

  }

  return jRadioButton;

 }

 /

   This method initializes jRadioButton1 

    

   @return javaxswingJRadioButton 

  /

 private JRadioButton getJRadioButton1() {

  if (jRadioButton1 == null) {

   jRadioButton1 = new JRadioButton();

   jRadioButton1setBounds(new Rectangle(117, 62, 38, 26));

   jRadioButton1setText("女");

  }

  return jRadioButton1;

 }

 /

   This method initializes jComboBox 

    

   @return javaxswingJComboBox 

  /

 private JComboBox getJComboBox() {

  if (jComboBox == null) {

   String[] strcb={"计算机","电子","工商"};

   jComboBox = new JComboBox(strcb);

   jComboBoxsetBounds(new Rectangle(62, 108, 93, 18));

  }

  return jComboBox;

 }

 /

   This method initializes jComboBox1 

    

   @return javaxswingJComboBox 

  /

 private JComboBox getJComboBox1() {

  if (jComboBox1 == null) {

   String[] strcb2={"大专","本科","硕士","博士"};

   jComboBox1 = new JComboBox(strcb2);

   jComboBox1setBounds(new Rectangle(92, 150, 125, 18));

  }

  return jComboBox1;

 }

 /

   This method initializes jButton 

    

   @return javaxswingJButton 

  /

 private JButton getJButton() {

  if (jButton == null) {

   jButton = new JButton();

   jButtonsetBounds(new Rectangle(66, 181, 60, 28));

   jButtonsetText("提交");

   jButtonaddActionListener(new javaawteventActionListener() {

    public void actionPerformed(javaawteventActionEvent e) {

     String strname=jTextFieldgetText();

     String strsex="男";

     if(jRadioButton1isSelected()){

      strsex="女";

     }

     String strzy=jComboBoxgetSelectedItem()toString();

     String strwh=jComboBox1getSelectedItem()toString();

     jTextAreasetText("姓名:"+strname+"\r\n"+"性别:"+strsex+"\r\n"+"专业:"+strzy+"\r\n"+"文化:"+strwh);

    }

   });

  }

  return jButton;

 }

 /

   This method initializes jButton1 

    

   @return javaxswingJButton 

  /

 private JButton getJButton1() {

  if (jButton1 == null) {

   jButton1 = new JButton();

   jButton1setBounds(new Rectangle(158, 181, 60, 28));

   jButton1setText("取消");

   jButton1addActionListener(new javaawteventActionListener() {

    public void actionPerformed(javaawteventActionEvent e) {

     Systemexit(0);

    }

   });

  }

  return jButton1;

 }

 /

   This method initializes jTextArea 

    

   @return javaxswingJTextArea 

  /

 private JTextArea getJTextArea() {

  if (jTextArea == null) {

   jTextArea = new JTextArea();

   jTextAreasetBounds(new Rectangle(16, 225, 229, 130));

  }

  return jTextArea;

 }

 public static void main(String args[]){

  new MyLuRu();

 }

效果如下图:

照你这个做了一下 仅供参考

import javaawtevent;

import javaxswing;

public class Main

{

public static void main(String[] args)

{

new MainFrame();

}

}

class MainFrame extends JFrame

{

public MainFrame()

{

JLabel lbl1 = new JLabel("计算圆形,请输入数据!", JLabelCENTER);

JLabel lbl2 = new JLabel("半径(r)", JLabelRIGHT);

JLabel lbl3 = new JLabel("结果是", JLabelRIGHT);

JLabel lbl4 = new JLabel("计算矩形,请输入数据!", JLabelCENTER);

JLabel lbl5 = new JLabel("长(l)", JLabelRIGHT);

JLabel lbl6 = new JLabel("宽(w)", JLabelRIGHT);

JLabel lbl7 = new JLabel("结果", JLabelRIGHT);

final JTextField txt1 = new JTextField();

final JTextField txt2 = new JTextField();

final JTextField txt3 = new JTextField();

final JTextField txt4 = new JTextField();

final JTextField txt5 = new JTextField();

JButton btn1 = new JButton("计算圆形周长");

JButton btn2 = new JButton("计算圆形面积");

JButton btn3 = new JButton("计算矩形周长");

JButton btn4 = new JButton("计算矩形面积");

JButton btn5 = new JButton();

lbl1setBounds(0, 0, 300, 20);

lbl2setBounds(0, 30, 100, 20);

lbl3setBounds(0, 60, 100, 20);

lbl4setBounds(0, 120, 300, 20);

lbl5setBounds(0, 150, 100, 20);

lbl6setBounds(0, 180, 100, 20);

lbl7setBounds(0, 210, 100, 20);

txt1setBounds(110, 30, 150, 20);

txt2setBounds(110, 60, 150, 20);

txt3setBounds(110, 150, 150, 20);

txt4setBounds(110, 180, 150, 20);

txt5setBounds(110, 210, 150, 20);

btn1setBounds(20, 90, 125, 20);

btn2setBounds(155, 90, 125, 20);

btn3setBounds(20, 240, 125, 20);

btn4setBounds(155, 240, 125, 20);

btn5setBounds(135, 270, 30, 10);

btn1addMouseListener(new MouseAdapter()

{

public void mouseClicked(MouseEvent e)

{

if (0 == txt1getText()length()) JOptionPaneshowMessageDialog(egetComponent(), "空的圆半径", "警告", JOptionPaneWARNING_MESSAGE);

else

{

Double result = 2 IntegerparseInt(txt1getText()) MathPI;

txt2setText(resulttoString());

}

}

});

btn2addMouseListener(new MouseAdapter()

{

public void mouseClicked(MouseEvent e)

{

if (0 == txt1getText()length()) JOptionPaneshowMessageDialog(egetComponent(), "空的圆半径", "警告", JOptionPaneWARNING_MESSAGE);

else

{

Double result = Mathpow(IntegerparseInt(txt1getText()), 2) MathPI;

txt2setText(resulttoString());

}

}

});

btn3addMouseListener(new MouseAdapter()

{

public void mouseClicked(MouseEvent e)

{

if (0 == txt3getText()length() || 0 == txt4getText()length()) JOptionPaneshowMessageDialog(egetComponent(), "空的矩形长或宽", "警告", JOptionPaneWARNING_MESSAGE);

else

{

Integer result = 2 (IntegerparseInt(txt3getText()) + IntegerparseInt(txt4getText()));

txt5setText(resulttoString());

}

}

});

btn4addMouseListener(new MouseAdapter()

{

public void mouseClicked(MouseEvent e)

{

if (0 == txt3getText()length() || 0 == txt4getText()length()) JOptionPaneshowMessageDialog(egetComponent(), "空的矩形长或宽", "警告", JOptionPaneWARNING_MESSAGE);

else

{

Integer result = IntegerparseInt(txt3getText()) IntegerparseInt(txt4getText());

txt5setText(resulttoString());

}

}

});

btn5addMouseListener(new MouseAdapter()

{

public void mouseClicked(MouseEvent e)

{

Systemexit(0);

}

});

add(lbl1);

add(lbl2);

add(lbl3);

add(lbl4);

add(lbl5);

add(lbl6);

add(lbl7);

add(txt1);

add(txt2);

add(txt3);

add(txt4);

add(txt5);

add(btn1);

add(btn2);

add(btn3);

add(btn4);

add(btn5);

setBounds(100, 100, 300, 350);

setDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

setLayout(null);

setResizable(false);

setVisible(true);

}

}

自己写的,能实现基本功能:

import javaawtBorderLayout;

import javaawtFileDialog;

import javaawtFont;

import javaawtdatatransferClipboard;

import javaawtdatatransferDataFlavor;

import javaawtdatatransferStringSelection;

import javaawtdatatransferTransferable;

import javaawtdatatransferUnsupportedFlavorException;

import javaawteventActionEvent;

import javaawteventActionListener;

import javaioBufferedReader;

import javaioBufferedWriter;

import javaioFile;

import javaioFileNotFoundException;

import javaioFileReader;

import javaioFileWriter;

import javaioIOException;

import javaxswingJFrame;

import javaxswingJMenu;

import javaxswingJMenuBar;

import javaxswingJMenuItem;

import javaxswingJOptionPane;

import javaxswingJPanel;

import javaxswingJScrollPane;

import javaxswingJTextArea;

import javaxswingborderTitledBorder;

/因为根据个人的电脑路径可能有所偏差,没有源路径的情况下,设置默认保存路径为D盘根目录下

若要选择保存其他地方,可以选择 另存为/

public class TestDemo extends JFrame {

private static final long serialVersionUID = -5355432125621015300L;

private String url = null;//文件路径

private String str=null;//复制或剪切 的字符串

private StringSelection stringSelection=null;

private Clipboard clipboard=new Clipboard(str);

private Transferable transferable=null;

private DataFlavor flavor=null;

public TestDemo() {

init();

}

private void init() {

setTitle("我的记事本");

setSize(500, 600);

setContentPane(createContentPane());//添加主面板

}

/创建主面板/

private JPanel createContentPane() {

JPanel pane = new JPanel(new BorderLayout());

paneadd(BorderLayoutNORTH, createChocePane());//添加菜单栏

paneadd(createAreaPane());//添加文本编辑区域

return pane;

}

/创建菜单栏,以及实现功能/

private JPanel createChocePane() {

JPanel pane = new JPanel();

JMenuBar menuBar1 = new JMenuBar();

JMenu menu = new JMenu("文件");

menuBar1add(menu);

JMenuItem menuIt1 = new JMenuItem("新建");

JMenuItem menuIt2 = new JMenuItem("打开");

JMenuItem menuIt3 = new JMenuItem("保存");

JMenuItem menuIt4 = new JMenuItem("另存为");

menuadd(menuIt1);

menuadd(menuIt2);

menuadd(menuIt3);

menuadd(menuIt4);

JMenuBar menuBar2 = new JMenuBar();

JMenu menu2 = new JMenu("编辑");

menuBar2add(menu2);

JMenuItem menuIt5 = new JMenuItem("复制");

JMenuItem menuIt6 = new JMenuItem("剪切");

JMenuItem menuIt7 = new JMenuItem("粘帖");

menu2add(menuIt5);

menu2add(menuIt6);

menu2add(menuIt7);

JMenuBar menuBar3 = new JMenuBar();

JMenu menu3 = new JMenu("帮助");

menuBar3add(menu3);

JMenuItem menuIt8 = new JMenuItem("关于记事本");

menu3add(menuIt8);

paneadd(menuBar1);

paneadd(menuBar2);

paneadd(menuBar3);

menuIt1addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

testAreasetText(null);

}

});

menuIt2addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

final FileDialog fd = new FileDialog(new JFrame(), "查找文件",

FileDialogLOAD);

fdsetVisible(true);

if (fdgetDirectory() != null && fdgetFile() != null) {

testAreasetText(null);

url = fdgetDirectory() + fdgetFile();

try {

BufferedReader in = new BufferedReader(new FileReader(

url));

for (int i = 0;; i++) {

testAreaappend(inreadLine());

if (inread() == -1) {

break;

} else

continue;

}

} catch (FileNotFoundException e) {

eprintStackTrace();

} catch (IOException e) {

eprintStackTrace();

}

}

}

});

menuIt3addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

if (url==null) {

url="D:\\新建 文本文档txt";

}

File f = new File(url);

BufferedWriter out = null;

try {

out = new BufferedWriter(new FileWriter(url));

fcreateNewFile();

outappend(testAreagetText());

outflush();

} catch (IOException e1) {

e1printStackTrace();

} finally {

try {

outclose();

} catch (IOException e1) {

e1printStackTrace();

}

}

}

});

menuIt4addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

FileDialog fd = new FileDialog(new JFrame(), "保存文本",

FileDialogSAVE);

fdsetVisible(true);

if (url!=null) {

File f = new File(url);

BufferedWriter out = null;

try {

fcreateNewFile();

out = new BufferedWriter(new FileWriter(url));

outappend(testAreagetText());

outflush();

} catch (IOException e) {

eprintStackTrace();

} finally {

try {

outclose();

} catch (IOException e) {

eprintStackTrace();

}

}

}

}

});

menuIt5addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

str=testAreagetSelectedText();

stringSelection=new StringSelection(str);

clipboardsetContents(stringSelection, null);

}

});

menuIt6addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

str=testAreagetSelectedText();

stringSelection=new StringSelection(str);

clipboardsetContents(stringSelection, null);

int start=testAreagetSelectionStart();

int end=testAreagetSelectionEnd();

testAreareplaceRange( null,start,end);

}

});

menuIt7addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

transferable=clipboardgetContents(this);

flavor=DataFlavorstringFlavor;

if (transferableisDataFlavorSupported(flavor)) {

int start=testAreagetSelectionStart();

int end=testAreagetSelectionEnd();

testAreareplaceRange( null,start,end);

int pos=testAreagetCaretPosition();

try {

str=(String)transferablegetTransferData(flavor);

testAreainsert(str, pos);

} catch (UnsupportedFlavorException e1) {

e1printStackTrace();

} catch (IOException e1) {

e1printStackTrace();

}

}

}

});

menuIt8addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JOptionPaneshowMessageDialog(null,"功能简单,绝对原创 ");

}

});

return pane;

}

JTextArea testArea;

private JScrollPane createAreaPane() {

JScrollPane pane = new JScrollPane();

panesetBorder(new TitledBorder("编辑区域"));

testArea = new JTextArea();

testAreasetFont(new Font("宋体", FontBOLD, 13));

testAreasetLineWrap(true);

panegetViewport()add(testArea);

return pane;

}

public static void main(String[] args) {

TestDemo td = new TestDemo();

tdsetVisible(true);

}

}

int[] numbers = new int[5];

Random random = new Random();

for (int i = 0; i < numberslength; i++) {

int number = randomnextInt(99) % (99 - 1 + 1) + 1;

numbers[i] = number;

}

StringBuffer rendomNum = new StringBuffer();

for (int number : numbers) {

rendomNumappend(number)append(" ");

}

Systemoutprintln("随机生成数字元素为:\n" + rendomNum);

Scanner scanner = new Scanner(Systemin);

Systemoutprint("请输入一个数字(2-5):");

int nextInt = scannernextInt();

StringBuffer sb = new StringBuffer();

for (int number : numbers) {

if (number % nextInt == 0) {

sbappend(number)append(" ");

}

}

if (sblength() > 0) {

Systemoutprintln("符合条件的数:\n" + sb);

} else {

Systemoutprintln("没有符合条件的数字");

}

简单个人简历java录入程序 代码

我帮你写了那些JAVA代码了,效果包你满意!呵呵……至于网页的代码嘛,这里就不贴了。你要的话HI我吧^_^。JAVA代码如下:import javaawtBo...
点击下载
热门文章
    确认删除?
    回到顶部