📄 frame1.java~21~
字号:
package shen;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import sfzchange.generated.Shen_Impl;
import sfzchange.generated.*;
import java.lang.Exception.*;
import java.io.*;
import java.rmi.*;
public class Frame1 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JTextField txtid = new JTextField();
JButton btnzh = new JButton();
JButton btncz = new JButton();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setSize(new Dimension(400, 300));
setTitle("Frame Title");
jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 15));
jLabel1.setText("身份证号码15位到18位转换");
jLabel1.setBounds(new Rectangle(107, 10, 215, 27));
jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
jLabel2.setText("15位身份证码:");
jLabel2.setBounds(new Rectangle(35, 38, 110, 23));
jLabel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
jLabel3.setText("18位身份证号码:");
jLabel3.setBounds(new Rectangle(21, 75, 113, 25));
jLabel4.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
jLabel4.setText("出生日期:");
jLabel4.setBounds(new Rectangle(60, 110, 69, 27));
jLabel5.setFont(new java.awt.Font("Dialog", Font.PLAIN, 13));
jLabel5.setText("性别:");
jLabel5.setBounds(new Rectangle(85, 146, 68, 28));
txtid.setText("");
txtid.setBounds(new Rectangle(150, 40, 181, 23));
btnzh.setBounds(new Rectangle(85, 194, 73, 25));
btnzh.setText("转换");
btnzh.addActionListener(new Frame1_btnzh_actionAdapter(this));
btncz.setBounds(new Rectangle(229, 194, 73, 25));
btncz.setText("重置");
btncz.addActionListener(new Frame1_btncz_actionAdapter(this));
jLabel6.setText("jLabel6");
jLabel6.setBounds(new Rectangle(114, 236, 166, 25));
jLabel7.setText("jLabel7");
jLabel7.setBounds(new Rectangle(151, 76, 185, 25));
jLabel8.setText("jLabel8");
jLabel8.setBounds(new Rectangle(150, 110, 183, 29));
jLabel9.setText("jLabel9");
jLabel9.setBounds(new Rectangle(150, 149, 171, 24));
contentPane.add(jLabel1);
contentPane.add(btnzh);
contentPane.add(jLabel2);
contentPane.add(jLabel3);
contentPane.add(jLabel4);
contentPane.add(jLabel5);
contentPane.add(jLabel6);
contentPane.add(btncz);
contentPane.add(jLabel9);
contentPane.add(jLabel8);
contentPane.add(jLabel7);
contentPane.add(txtid);
}
public void btncz_actionPerformed(ActionEvent e) {
this.txtid.setText("");
}
public void btnzh_actionPerformed(ActionEvent e) {
String len = txtid.getText();
if (len.length() != 15) {
this.jLabel6.setText("您输入身份证号码不是15位!");
} else {
this.jLabel6.setText("");
String wsdUrl =
"http://localhost:7001/Shenweb-services/ShenBean1?WSDL";
Shen_Impl service = null;
ShenPort port = service.getshenPort();
// try {
// port.idd(this.txtid.getText());
// } catch (RemoteException ex) {
// }
try {
this.jLabel7.setText(port.newid(this.txtid.getText()));
} catch (RemoteException ex1) {
}
try {
this.jLabel8.setText(port.sex(this.txtid.getText()));
} catch (RemoteException ex2) {
}
try {
this.jLabel9.setText(port.newid(this.jLabel8.getText()));
} catch (RemoteException ex3) {
}
}
}
}
class Frame1_btnzh_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_btnzh_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnzh_actionPerformed(e);
}
}
class Frame1_btncz_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_btncz_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btncz_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -