help me, in my program that should put data to a table, it happens that when I give register does not enter the data to the table the error is as follows package registration.client;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.io.File;
import java.util.Calendar;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
/**
*
* @author JCCM
*/
public class Registro extends javax.swing.JFrame {
private static final long serialVersionUID = 6530913924448000342L;
public Register data = new Register();
DefaultTableModel model = new DefaultTableModel();
int cod = data.getCod();
String name = data.getName();
String appname = data.getAppname();
String apmname = data.getApmname();
int phone = data.getTelephone();
String time = data.getTime();
String join = data.getJoin();
int EP;
String fecha;
public void tabla (){
model.addColumn("Codigo");
model.addColumn("Nombre");
model.addColumn("Apellidos");
model.addColumn("Telefono");
model.addColumn("Hora Ingreso");
model.addColumn("Ocupacion");
model.addColumn("Empresa");
model.addColumn("Fecha");
Registro.tdDatos.setModel(model);
}
public Registro() {
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() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
txtCod = new javax.swing.JTextField();
txtName = new javax.swing.JTextField();
txtNameapm = new javax.swing.JTextField();
txtnameap = new javax.swing.JTextField();
txtPhone = new javax.swing.JTextField();
txtJoin = new javax.swing.JTextField();
cbxEmpresa = new javax.swing.JComboBox<>();
dchFecha = new com.toedter.calendar.JDateChooser();
txtTime = new javax.swing.JTextField();
jpPhoto = new javax.swing.JLabel();
btLoad = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
cbxSexo = new javax.swing.JComboBox<>();
btReg = new javax.swing.JButton();
btNew = new javax.swing.JButton();
btLogin = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tdDatos = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("REGISTRO DE EMPLEADOS CENTRAL");
jLabel2.setText("CODIGO:");
jLabel3.setText("Nombres Completos:");
jLabel4.setText("Apellido Paterno:");
jLabel5.setText("Apellido Materno:");
jLabel6.setText("Telefono\Cel.:");
jLabel7.setText("Fecha de Ingreso:");
jLabel8.setText("Cargo\Ocupacion:");
jLabel9.setText("Ubicacion de Servicios:");
jLabel10.setText("Hora:");
txtCod.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtCodKeyTyped(evt);
}
});
txtName.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNameKeyTyped(evt);
}
});
txtNameapm.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNameapmKeyTyped(evt);
}
});
txtnameap.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtnameapKeyTyped(evt);
}
});
txtPhone.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtPhoneKeyTyped(evt);
}
});
cbxEmpresa.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione Empresa", "ServiCell", "Yimy S.A", "Ambas Empresas", " " }));
txtTime.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtTimeKeyTyped(evt);
}
});
jpPhoto.setText("Imagen");
jpPhoto.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Fotografia", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.ABOVE_TOP, new java.awt.Font("Dialog", 0, 11), new java.awt.Color(0, 0, 204))); // NOI18N
btLoad.setText("Cargar Imagen");
btLoad.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btLoadActionPerformed(evt);
}
});
jLabel12.setText("SEXO:");
cbxSexo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione.....", "Masculino", "Femenino" }));
btReg.setText("Registrar");
btReg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btRegActionPerformed(evt);
}
});
btNew.setText("Nuevo");
btNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btNewActionPerformed(evt);
}
});
btLogin.setText("Ver Registro");
btLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btLoginActionPerformed(evt);
}
});
tdDatos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tdDatos);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(188, 188, 188)
.addComponent(btLogin)
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtCod)
.addComponent(txtName)
.addComponent(txtnameap)
.addComponent(txtNameapm)
.addComponent(txtPhone)
.addComponent(dchFecha, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)
.addComponent(txtTime, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel10))
.addGap(72, 72, 72)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbxSexo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(btNew, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btReg, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cbxEmpresa, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(btLoad, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
.addComponent(jpPhoto, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(37, 37, 37)
.addComponent(txtJoin, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(20, 20, 20))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE)
.addGap(31, 31, 31))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(btLogin))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel8)
.addComponent(txtCod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtJoin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel9)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbxEmpresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtnameap, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(txtNameapm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(dchFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10)
.addComponent(txtTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cbxSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(28, 28, 28)
.addComponent(btNew))))
.addGroup(layout.createSequentialGroup()
.addGap(8, 8, 8)
.addComponent(jpPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btReg)
.addComponent(btLoad))))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
.addGap(6, 6, 6))
);
pack();
}// </editor-fold>
private void btLoginActionPerformed(java.awt.event.ActionEvent evt) {
}
private void btRegActionPerformed(java.awt.event.ActionEvent evt) {
cod=(Integer.valueOf(txtCod.getText()));
data.setName(txtName.getText());
data.setAppname(txtnameap.getText());
data.setApmname(txtNameapm.getText());
data.setTelephone(Integer.valueOf(txtPhone.getText()));
data.setTime(txtTime.getText());
// fecha
String dia = Integer.toString(dchFecha.getCalendar().get(Calendar.DAY_OF_MONTH));
String mes= Integer.toString(dchFecha.getCalendar().get(Calendar.MONTH) + 1);
String anio= Integer.toString(dchFecha.getCalendar().get(Calendar.YEAR));
fecha = dia+mes+anio;
data.setJoin(txtJoin.getText());
cbxSexo.getSelectedIndex();
EP = cbxEmpresa.getSelectedIndex();
String [] Agregar = new String[8];
Agregar[0]= txtCod.getText();
Agregar[1]= txtName.getText();
Agregar[2]= data.getAppname()+" "+data.getApmname();
Agregar[3]= Integer.toString(data.getTelephone());
Agregar[4]= data.getTime();
Agregar[5]= data.getJoin();
Agregar[6]= Integer.toString(cbxEmpresa.getSelectedIndex());
Agregar[7]= fecha;
model.addRow(Agregar);
}
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not supported yet. at record.client.Register.setTime (Register.java:161) at registration.client.Registration.btRegActionPerformed (Registration.java:339) at record.client.Registration.access $ 700 (Record.java:24) at record.client.Registro $ 8.actionPerformed (Registro.java:171) at javax.swing.AbstractButton.fireActionPerformed (AbstractButton.java:2022) at javax.swing.AbstractButton $ Handler.actionPerformed (AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed (DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased (BasicButtonListener.java:252) at java.awt.Component.processMouseEvent (Component.java:6533) at javax.swing.JComponent.processMouseEvent (JComponent.java:3324) at java.awt.Component.processEvent (Component.java:6298) at java.awt.Container.processEvent (Container.java:2236) at java.awt.Component.dispatchEventImpl (Component.java:4889) at java.awt.Container.dispatchEventImpl (Container.java:2294) at java.awt.Component.dispatchEvent (Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent (Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent (Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent (Container.java:4466) at java.awt.Container.dispatchEventImpl (Container.java:2280) at java.awt.Window.dispatchEventImpl (Window.java:2746) at java.awt.Component.dispatchEvent (Component.java:4711) at java.awt.EventQueue.dispatchEventImpl (EventQueue.java:758) at java.awt.EventQueue.access $ 500 (EventQueue.java:97) at java.awt.EventQueue $ 3.run (EventQueue.java:709) at java.awt.EventQueue $ 3.run (EventQueue.java:703) at java.security.AccessController.doPrivileged (Native Method) at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege (ProtectionDomain.java:80) at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege (ProtectionDomain.java:90) at java.awt.EventQueue $ 4.run (EventQueue.java:731) at java.awt.EventQueue $ 4.run (EventQueue.java:729) at java.security.AccessController.doPrivileged (Native Method) at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege (ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent (EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters (EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter (EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:93) at java.awt.EventDispatchThread.run (EventDispatchThread.java:82)
the other register code is this
package registro.de.cliente;
/**
*
* @author JCCM
*/
public final class Register{
private int cod;
private String name;
private String appname;
private String apmname;
private int telephone;
private String join;
private String time;
void Register() {
setcod(0);
setname("");
setappname("");
setapmname("");
settelephone(0);
setjoin("");
settime("");
//To change body of generated methods, choose Tools | Templates.
}
void Register(int pcod, String pname, String pappname, String papmname, int ptelephone, String pjoin, String ptime) {
setcod(pcod);
setname(ptime);
setAppname(pappname);
setApmname(papmname);
setTelephone(ptelephone);
setjoin(pjoin);
setTime(ptime);
}
// constructor copia
/**
* @return the cod
*/
public int getCod() {
return cod;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the appname
*/
public String getAppname() {
return appname;
}
/**
* @param appname the appname to set
*/
public void setAppname(String appname) {
this.appname = appname;
}
/**
* @return the apmname
*/
public String getApmname() {
return apmname;
}
/**
* @param apmname the apmname to set
*/
public void setApmname(String apmname) {
this.apmname = apmname;
}
/**
* @return the telephone
*/
public int getTelephone() {
return telephone;
}
/**
* @param telephone the telephone to set
*/
public void setTelephone(int telephone) {
this.telephone = telephone;
}
/**
* @return the join
*/
public String getJoin() {
return join;
}
/**
* @param join the join to set
*/
public void setJoin(String join) {
this.join = join;
}
/**
* @return the time
*/
public String getTime() {
return time;
}
public void setcod(int pcod) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void setname(String ptime) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void setjoin(String pjoin) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void setappname(String string) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void setapmname(String string) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void settelephone(int i) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void settime(String string) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
void setTime(String text) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}