PLEASE WHAT'S WRONG WITH THIS CODES, I KEEP GETTING ERROR AT THIS STAGE
String result = ci.insertDetails(cid, name, dateOfBirth,
String.valueOf(cms.getSelectedItem()), address, city, state , zcode, cnum, nod);
String day = String.valueOf(d.getSelectedItem());
String month = String.valueOf(m.getSelectedItem());
String year = String.valueOf(y.getSelectedItem());
String ms = String.valueOf(cms.getSelectedItem());
String dob = year + "-" + (m.getSelectedIndex() + 1) + "-" + day;
HERE'S THE FULL CODE.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class CustomerInformation extends JDialog implements ActionListener{
JLabel heading = new JLabel("CUSTOMER INFORMATION");
JLabel cid = new JLabel("Customer id");
JTextField tcid = new JTextField(10);
JLabel name = new JLabel("First Name (Mr/Mrs/Miss):");
JTextField tname = new JTextField(10);
JLabel lname = new JLabel("Last Name:");
JLabel dob = new JLabel("Date Of Birth");
JComboBox d = new JComboBox();
JComboBox m = new JComboBox();
JComboBox y = new JComboBox();
JLabel ms = new JLabel("Marital Status");
JLabel day = new JLabel("Day");
JLabel mon = new JLabel("Month");
JLabel year = new JLabel("Year");
JComboBox cms = new JComboBox();
String[] ccms={"","Single", "Married"};
String[] mont ={"","Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept","Oct", "Nov", "Dec"};
JLabel address = new JLabel("Address");
JTextField tlname = new JTextField(10);
JTextField taddress = new JTextField(20);
JLabel city = new JLabel("City");
JTextField tcity = new JTextField(15);
JLabel state = new JLabel("State");
JTextField tstate = new JTextField(10);
JLabel zcode = new JLabel("ZipCode");
JTextField tzcode = new JTextField(10);
JLabel cnum = new JLabel("Contact Number");
JTextField tcnum = new JTextField(15);
JLabel nod = new JLabel("Number Of Dependent");
JTextField tnod = new JTextField(10);
JButton sub = new JButton("Submit");
JButton clear = new JButton("Clear");
GridBagConstraints gbc = new GridBagConstraints();
GridBagLayout gbl = new GridBagLayout();
public CustomerInformation(Frame f){
super(f, true);
//setModal(true);
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(3, 5, 3, 5);
setLayout(gbl);
tcid.setEditable(false);
tcid.setText(generateId());
heading.setForeground(Color.BLUE);
heading.setFont(new Font("Arial", Font.BOLD, 22));
JButton close = new JButton("Close");
close.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
for(int i = 0; i <ccms.length; i++) {
cms.addItem(ccms[i]);
}
for(int i = 0; i <= 31; i++) {
d.addItem("" + i);
}
for(int i = 1940; i <= 20020; i++) {
y.addItem("" + i);
}
for(int i = 0; i < mont.length; i++) {
m.addItem(mont[i]);
}
addComponent(heading, 0, 0);
addComponent(cid, 0, 1);
addComponent(tcid, 1, 1);
addComponent(name, 0, 2);
addComponent(tname, 1, 2);
addComponent(lname, 2, 2);
addComponent(tlname,3,2);
addComponent(dob, 0, 3);
addComponent(d, 1, 3);
addComponent(m, 2, 3);
addComponent(y, 3, 3);
addComponent(ms, 0, 4);
addComponent(cms, 1, 4);
addComponent(address, 0, 5);
addComponent(taddress, 1, 5);
addComponent(city, 0, 6);
addComponent(tcity, 1, 6);
addComponent(state, 0, 7);
addComponent(tstate, 1, 7);
addComponent(zcode, 0, 8);
addComponent(tzcode, 1, 8);
addComponent(cnum, 0, 9);
addComponent(tcnum, 1, 9);
addComponent(nod, 0, 10);
addComponent(tnod, 1, 10);
addComponent(sub, 0, 11);
addComponent(clear, 1, 11);
addComponent(close, 2, 11);
sub.addActionListener(this);
clear.addActionListener(this);
getRootPane().setDefaultButton(sub);
}
public String generateId() {
final String validChars = "0123456789";
java.util.Random rnd = new java.util.Random();
String id = "";
for(int i = 0; i < 3; i++) {
id += validChars.charAt(rnd.nextInt(validChars.length()));
}
return id;
}
private void addComponent(Component component, int row, int column){
gbc.gridx = row;
gbc.gridy = column;
gbl.setConstraints(component, gbc);
add(component);
}
public void actionPerformed(ActionEvent ae) {
if(ae.getSource() == clear){
tname.setText("");
tlname.setText("");
taddress.setText("");
tcity.setText("");
tstate.setText("");
tzcode.setText("");
tcnum.setText("");
tnod.setText("");
cms.setSelectedIndex(0);
d.setSelectedIndex(0);
m.setSelectedIndex(0);
y.setSelectedIndex(0);
}
if(ae.getSource() == sub) {
try{
System.setSecurityManager(new java.rmi.RMISecurityManager());
Registry registry = LocateRegistry.getRegistry("localhost", 1099);
CustomerInformationServer chi = (CustomerInformationServer)registry.lookup("CustomerInformationServer");
System.out.println("Services available.");
String cid = tcid.getText();
String name = tname.getText();
String lname = tlname.getText();
String city = tcity.getText();
String state = tstate.getText();
int code = Integer.parseInt(tzcode.getText());
String cnum = tcnum.getText();
String address = taddress.getText();int nod = Integer.parseInt(tnod.getText());
String cms1 = String.valueOf(cms.getSelectedItem());
String dateOfBirth = d.getSelectedItem() + "/" + m.getSelectedItem() + "/" + y.getSelectedItem();
String result = ci.insertDetails(cid, name, dateOfBirth,
String.valueOf(cms.getSelectedItem()), address, city, state , zcode, cnum, nod);
String day = String.valueOf(d.getSelectedItem());
String month = String.valueOf(m.getSelectedItem());
String year = String.valueOf(y.getSelectedItem());
String ms = String.valueOf(cms.getSelectedItem());
String dob = year + "-" + (m.getSelectedIndex() + 1) + "-" + day;
System.out.println("Services not found.");
} catch(java.rmi.NotBoundException e) {
} catch(Exception e) {e.printStackTrace();}
System.out.println("An unknown error occurred");
if(name.equals("")){
JOptionPane.showMessageDialog(this, "customer name cannot be blank");
return;
}
if(address.equals("")){
JOptionPane.showMessageDialog(this, "Please Enter your Address");
return;
}
if(city.equals("")){
JOptionPane.showMessageDialog(this, "City cannot be blank");
return;
}
if(state.equals("")){
JOptionPane.showMessageDialog(this, "Please Enter your State");
return;
}
if (tzcode.equals("")){
JOptionPane.showMessageDialog(this, "Please Enter your ZipCode");
return;
}
if(cnum.equals("")){
JOptionPane.showMessageDialog(this, "Please Enter your Contact Number");
return;
}
}
}
}