📄 frame6.java
字号:
import java.awt.BorderLayout;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Dimension;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Font;
import javax.swing.JPasswordField;
import java.awt.Point;
import java.rmi.Naming;
import java.rmi.RemoteException;
import javax.swing.ImageIcon;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Frame6 extends JFrame {
private static final long serialVersionUID = 1L;
private JButton jButton2;
private JLabel jLabel2;
private JLabel jLabel4;
private JTextField jTextField1;
private JTextField name;
private JLabel jLabel3;
private JLabel jLabel1;
private JButton jButton3;
private JPanel jContentPane = null;
private JComboBox jComboBox = null;
private JLabel jLabel = null;
private JPasswordField jPasswordField = null;
private JLabel jLabel5 = null;
private JTextField jTextField = null;
private JLabel jLabel6 = null;
private JPasswordField jPasswordField1 = null;
private JLabel jLabel7 = null;
private String url = null;
private boolean isconnected = false;
private CommunityServerInterface thecommunity; // @jve:decl-index=0:
private Virtualperson person;
private JLabel jLabel8 = null;
private JLabel jLabel9 = null;
private JLabel jLabel10 = null;
private JLabel jLabel11 = null;
/**
* This is the default constructor
*/
public Frame6() {
super();
initialize();
}
public Frame6(String url) {
super();
this.url = url;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(314, 424);
this.setLocation(new Point(300, 150));
this.setTitle("会员注册");
this.setVisible(true);
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel11 = new JLabel();
jLabel11.setBounds(new Rectangle(16, 315, 243, 18));
jLabel11.setText("请确保您输入的帐户是正确的。");
jLabel10 = new JLabel();
jLabel10.setBounds(new Rectangle(16, 286, 246, 18));
jLabel10.setText("销售公司销售软件时,资金将装入该账户");
jLabel9 = new JLabel();
jLabel9.setBounds(new Rectangle(250, 273, 55, 20));
jLabel9.setText(" 司必填");
jLabel8 = new JLabel();
jLabel8.setBounds(new Rectangle(250, 249, 56, 24));
jLabel8.setText("*销售公");
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(247, 207, 48, 27));
jLabel7.setText("*选填");
jLabel6 = new JLabel();
jLabel6.setBounds(new Rectangle(17, 129, 66, 26));
jLabel6.setText("确认密码:");
jLabel5 = new JLabel();
jLabel5.setBounds(new Rectangle(22, 251, 66, 18));
jLabel5.setText("银行账户:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(15, 4, 203, 34));
jLabel.setFont(new Font("Dialog", Font.BOLD, 18));
jLabel.setIcon(new ImageIcon(getClass().getResource("/ball.jpg")));
jLabel.setText("欢迎注册社区会员:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton2());
jContentPane.add(getJButton3());
jContentPane.add(getJLabel1());
jContentPane.add(getJLabel2());
jContentPane.add(getJLabel3());
jContentPane.add(getJLabel4());
jContentPane.add(getname());
jContentPane.add(getJTextField1());
jContentPane.add(getJComboBox(), null);
jContentPane.add(jLabel, null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(jLabel5, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(jLabel6, null);
jContentPane.add(getJPasswordField1(), null);
jContentPane.add(jLabel7, null);
jContentPane.add(jLabel8, null);
jContentPane.add(jLabel9, null);
jContentPane.add(jLabel10, null);
jContentPane.add(jLabel11, null);
}
return jContentPane;
}
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setText("\u6ce8\u518c");
jButton2.setBounds(56, 352, 62, 24);
jButton2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
}
return jButton2;
}
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setText("\u53d6\u6d88");
jButton3.setBounds(157, 352, 65, 24);
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
System.exit(1);// TODO Auto-generated Event stub actionPerformed()
}
});
}
return jButton3;
}
private JLabel getJLabel1() {
if (jLabel1 == null) {
jLabel1 = new JLabel();
jLabel1.setText("\u7528\u6237\u540d\uff1a");
jLabel1.setBounds(24, 45, 55, 31);
}
return jLabel1;
}
private JLabel getJLabel2() {
if (jLabel2 == null) {
jLabel2 = new JLabel();
jLabel2.setText("\u5bc6\u7801\uff1a");
jLabel2.setBounds(24, 88, 55, 25);
}
return jLabel2;
}
private JLabel getJLabel3() {
if (jLabel3 == null) {
jLabel3 = new JLabel();
jLabel3.setText("注册身份:");
jLabel3.setBounds(16, 172, 66, 23);
}
return jLabel3;
}
private JLabel getJLabel4() {
if (jLabel4 == null) {
jLabel4 = new JLabel();
jLabel4.setText("地址:");
jLabel4.setBounds(24, 207, 58, 29);
}
return jLabel4;
}
private JTextField getname() {
if (name == null) {
name = new JTextField();
name.setText("huangyuping");
name.setBounds(97, 48, 142, 24);
}
return name;
}
private JTextField getJTextField1() {
if (jTextField1 == null) {
jTextField1 = new JTextField();
jTextField1.setText(" ");
jTextField1.setBounds(96, 208, 147, 24);
}
return jTextField1;
}
/**
* This method initializes jComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBox() {
if (jComboBox == null) {
jComboBox = new JComboBox(new String[] {
"VirtualPerson", "VeditionCompany",
"EmpolderCompany"});
jComboBox.setBounds(new Rectangle(97, 170, 145, 27));
}
return jComboBox;
}
/**
* This method initializes jPasswordField
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField() {
if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(97, 88, 142, 26));
jPasswordField.setText("123456");
}
return jPasswordField;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(97, 246, 147, 22));
}
return jTextField;
}
/**
* This method initializes jPasswordField1
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getJPasswordField1() {
if (jPasswordField1 == null) {
jPasswordField1 = new JPasswordField();
jPasswordField1.setBounds(new Rectangle(96, 129, 144, 25));
jPasswordField1.setText("123456");
}
return jPasswordField1;
}
private void jButton2ActionPerformed(ActionEvent evt) {
// System.out.println("jButton2.actionPerformed, event=" + evt);
if(initializeRMI()){
if(new String(jPasswordField.getPassword()).equals(new String(jPasswordField1.getPassword()))&&
jTextField.getText()!=null){
try{
if( thecommunity.addnewmember(name.getText(), new String(jPasswordField.getPassword()),(String)jComboBox.getSelectedItem()
,jTextField1.getText(),jTextField.getText())){
this.setVisible(false);
JOptionPane.showMessageDialog(null,"Succeed to register a memder!","Succeed",JOptionPane.OK_OPTION);
Frame2 frame =new Frame2(name.getText(), new String(jPasswordField.getPassword()),(String)jComboBox.getSelectedItem(),url);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
else
JOptionPane.showMessageDialog(null,"Failed to register a memder!Please retry!","failes",JOptionPane.NO_OPTION);
}
catch(RemoteException ex){
JOptionPane.showMessageDialog(null,"Internet is busy ,please retry!","Remote error",JOptionPane.ERROR_MESSAGE);
}
}
else
JOptionPane.showMessageDialog(null,"Please ensure your password and account","Password error",JOptionPane.ERROR_MESSAGE);
}
//TODO add your code for jButton2.actionPerformed
}
protected boolean initializeRMI(){
if(isconnected) return true;
if(url.equals("default"))
url = "";
String Url = "rmi://"+url+"/";
try{
thecommunity = (CommunityServerInterface)Naming.lookup(Url+"CommunityServerInterfaceImpl");
System.out.println("Server object "+thecommunity+" found");
isconnected = true;
return true;
}
catch(Exception ex){
System.out.println(Url);
System.out.println(ex);
JOptionPane.showMessageDialog(null,"Please enter right ID!","ID error",JOptionPane.ERROR_MESSAGE);
return false;
}
}
} // @jve:decl-index=0:visual-constraint="175,3"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -