posted 2 years ago
public class SignUp extends javax.swing.JFrame {
/**
* Creates new form SignUp
*/
public SignUp() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
BtnSave.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
BtnSave.setForeground(new java.awt.Color(25, 118, 211));
BtnSave.setText("SAVE");
BtnSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnSaveActionPerformed(evt);
}
});
jPanel1.add(BtnSave, new org.netbeans.lib.awtextra.AbsoluteConstraints(77, 777, 180, 55));
BtnBack.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
BtnBack.setForeground(new java.awt.Color(25, 118, 211));
BtnBack.setText("BACK");
BtnBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnBackActionPerformed(evt);
}
});
jPanel1.add(BtnBack, new org.netbeans.lib.awtextra.AbsoluteConstraints(287, 777, 180, 55));
disable.setBackground(new java.awt.Color(255, 255, 255));
disable.setForeground(new java.awt.Color(255, 255, 255));
disable.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
disable.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/hide.png"))); // NOI18N
disable.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
disableMouseClicked(evt);
}
});
jPanel1.add(disable, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 350, -1, 60));
jLabel11.setFont(new java.awt.Font("Segoe UI", 0, 26)); // NOI18N
jLabel11.setForeground(new java.awt.Color(255, 255, 255));
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel11.setText("x");
jLabel11.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel11MouseClicked(evt);
}
});
jPanel1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 0, 38, -1));
show1.setBackground(new java.awt.Color(255, 255, 255));
show1.setForeground(new java.awt.Color(255, 255, 255));
show1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
show1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/visible.png"))); // NOI18N
show1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
show1MouseClicked(evt);
}
});
jPanel1.add(show1, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 360, -1, 40));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
private void disableMouseClicked(java.awt.event.MouseEvent evt) {
txtpassword.setEchoChar((char)0);
disable.setVisible(false);
disable.setEnabled(false);
show.setEnabled(true);
show.setEnabled(true);
}
private void BtnBackActionPerformed(java.awt.event.ActionEvent evt) {
new Login().setVisible(true);
this.dispose();
}
private void jLabel11MouseClicked(java.awt.event.MouseEvent evt) {
System.exit(0);
}
private void BtnSaveActionPerformed(java.awt.event.ActionEvent evt) {
if(txtuserid.getText().isEmpty() || txtusername.getText().isEmpty() || txtuseremail.getText().isEmpty() || new String(txtpassword.getPassword()).isEmpty() || txtphone.getText().isEmpty() || sQuestxt.getSelectedItem() == null || Answtxt.getText().isEmpty() || AddressL1Text.getText().isEmpty() || AddressL2Text.getText().isEmpty()){
JOptionPane.showMessageDialog(this, "Kindly provide all information","Empty field!", JOptionPane.ERROR_MESSAGE);
}else{
try{
Registry theRegistry = LocateRegistry.getRegistry("127.0.0.1",1099);
UserInterface service = (UserInterface) theRegistry.lookup("user");
User theUser = new User();
theUser.setuNames(txtusername.getText());
theUser.setuEmail(txtuseremail.getText());
theUser.setuPassword(new String(txtpassword.getPassword()));
theUser.setuPhone(txtphone.getText());
theUser.setuAddress1(AddressL1Text.getText());
theUser.setuAddress2(AddressL2Text.getText());
User userObj = service.recordUser(theUser);
}catch(Exception ex){
ex.printStackTrace();
}
}
}
}
this is my code and the error is raising at
UserInterface service = (UserInterface) theRegistry.lookup("user");