Boton Eliminar Java NetBeans-Mysql
Publicado por Didier Francisco Orjuela Lopez (2 intervenciones) el 20/10/2012 07:32:02
Buenas Noches
Necesito un favor urgente, este es
Tengo esta interfaz http://sdrv.ms/TErsgi
El programa consta de una conexion entre Java Netbeans y Mysql
tengo 5 campos en las tabla contrato de mysql ya tengo el boyonactualizar y este los muestra en la tabla.
Necesito saber el codigo para poder eliminar por numero contrato (numero contrato tiene auto:incremento en mysql)
Tambien poder ordenar por numero contrato y el boton buscar les agardeceria mucho cualquier tipo de ayuda
ste es el codigo que tengo:
Cree una clase conectar esta es donde llamo la base de datos esta se llama icasaf dentro de esta esta la tabla contrato
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.*;
import java.sql.*;
/**
*
* @author User
*/
public class conectar {
Connection conect = null;
public Connection conexion()
{
try {
Class.forName("org.gjt.mm.mysql.Driver");
conect= DriverManager.getConnection("jdbc:mysql://localhost/icasaf", "root","12345" );
//JOptionPane.showMessageDialog(null, "Conectado");
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error"+e);
}
return conect;
}
}
Este es el codigo que tengo
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
/**
*
* @author User
*/
public class Contrato extends javax.swing.JFrame {
DefaultTableModel model;
/**
* Creates new form Contrato
*/
void cargar(String valor) {
String titulos [] = {"Numero", "Tipo", "Fecha", "T. Pago", "Codigo Cliente"};
String [] registros = new String [5];
String sql = "select*from contrato where N_CONT LIKE '%" +valor+"%'";
model = new DefaultTableModel(null, titulos);
conectar cc=new conectar();
Connection cn = cc.conexion();
try {
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while (rs.next()){
registros[0]=rs.getString("N_CONT");
registros[1]=rs.getString("TIP_CONT");
registros[2]=rs.getString("FECH_CONT");
registros[3]=rs.getString("TIPPAGO_CONT");
registros[4]=rs.getString("COD_CLIE");
model.addRow(registros);
}
t_datos.setModel(model);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
public Contrato() {
initComponents();
limpiar();
bloquear();
cargar("");
}
void limpiar(){
T1.setText("");
T2.setText("");
T3.setText("");
T4.setText("");
}
void bloquear() {
T1.setEnabled(false);
T2.setEnabled(false);
T3.setEnabled(false);
T4.setEnabled(false);
jButton1.setEnabled(true);
b2.setEnabled(false);
jButton3.setEnabled(false);
}
void desbloquear() {
T1.setEnabled(true);
T2.setEnabled(true);
T3.setEnabled(true);
T4.setEnabled(true);
jButton1.setEnabled(false);
b2.setEnabled(true);
jButton3.setEnabled(true);
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
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();
T1 = new javax.swing.JTextField();
T2 = new javax.swing.JTextField();
T3 = new javax.swing.JTextField();
T4 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
b2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
t_datos = new javax.swing.JTable();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
aux = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jButton2 = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(51, 51, 51));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Contrato", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Comic Sans MS", 1, 18), new java.awt.Color(204, 204, 204))); // NOI18N
jPanel1.setForeground(new java.awt.Color(204, 204, 204));
jLabel1.setBackground(new java.awt.Color(51, 51, 51));
jLabel1.setText("Numero:");
jLabel2.setBackground(new java.awt.Color(51, 51, 51));
jLabel2.setText("Tipo:");
jLabel3.setBackground(new java.awt.Color(51, 51, 51));
jLabel3.setText("Fecha:");
jLabel4.setBackground(new java.awt.Color(51, 51, 51));
jLabel4.setText("Tipo De Pago:");
jLabel5.setBackground(new java.awt.Color(51, 51, 51));
jLabel5.setText("Codigo Cliente:");
T1.setBackground(new java.awt.Color(51, 51, 51));
T1.setForeground(new java.awt.Color(204, 204, 204));
T1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T1ActionPerformed(evt);
}
});
T2.setBackground(new java.awt.Color(51, 51, 51));
T2.setForeground(new java.awt.Color(204, 204, 204));
T2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T2ActionPerformed(evt);
}
});
T3.setBackground(new java.awt.Color(51, 51, 51));
T3.setForeground(new java.awt.Color(204, 204, 204));
T3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T3ActionPerformed(evt);
}
});
T4.setBackground(new java.awt.Color(51, 51, 51));
T4.setForeground(new java.awt.Color(204, 204, 204));
T4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T4ActionPerformed(evt);
}
});
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Agre.png"))); // NOI18N
jButton1.setText("Nuevo");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
b2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Guar.png"))); // NOI18N
b2.setText("Agregar");
b2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b2ActionPerformed(evt);
}
});
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Cancelar.png"))); // NOI18N
jButton3.setText("Cancelar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Candado.png"))); // NOI18N
jButton4.setText("Salir");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
t_datos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane1.setViewportView(t_datos);
jLabel6.setForeground(new java.awt.Color(0, 153, 153));
jLabel6.setText("Auto_Incremento");
jLabel7.setForeground(new java.awt.Color(0, 102, 102));
jLabel7.setText("__________________________________________________________________________________________");
jLabel8.setForeground(new java.awt.Color(0, 102, 102));
jLabel8.setText("Buscar Por Numero Contrato:");
aux.setBackground(new java.awt.Color(0, 0, 0));
aux.setForeground(new java.awt.Color(0, 102, 102));
aux.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
auxKeyReleased(evt);
}
});
jLabel9.setForeground(new java.awt.Color(0, 102, 102));
jLabel9.setText("Eliminar Por Numero Contaro:");
jTextField6.setBackground(new java.awt.Color(0, 0, 0));
jTextField6.setForeground(new java.awt.Color(0, 102, 102));
jButton5.setText("Eliminar");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jRadioButton1.setBackground(new java.awt.Color(51, 51, 51));
jRadioButton1.setForeground(new java.awt.Color(204, 204, 204));
jRadioButton1.setText("Inicio");
jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
jRadioButton2.setBackground(new java.awt.Color(51, 51, 51));
jRadioButton2.setForeground(new java.awt.Color(204, 204, 204));
jRadioButton2.setText("Opciones Mysql.");
jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
jButton2.setText("Buscar");
jLabel10.setText("Ordenar POr:");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tipo Contrato", "Numero de Contrato", "Codigo Cliente" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel5))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(T2)
.addComponent(T1)
.addComponent(T4)
.addComponent(T3)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jRadioButton1)
.addGap(18, 18, 18)
.addComponent(jRadioButton2)))
.addGap(47, 47, 47)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(b2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jScrollPane1)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addGap(18, 18, 18)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(aux)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel10)
.addGap(70, 70, 70)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2)
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(aux, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(30, 30, 30))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10)
.addGap(18, 18, 18))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7)
.addGap(3, 3, 3)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel6))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(T1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(T2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(T3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(T4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(b2, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void T1ActionPerformed(java.awt.event.ActionEvent evt) {
T1.transferFocus();
// TODO add your handling code here:
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
desbloquear();
T1.requestFocus(); // TODO add your handling code here:
}
private void T2ActionPerformed(java.awt.event.ActionEvent evt) {
T2.transferFocus(); // TODO add your handling code here:
}
private void T3ActionPerformed(java.awt.event.ActionEvent evt) {
T3.transferFocus(); // TODO add your handling code here:
}
private void T4ActionPerformed(java.awt.event.ActionEvent evt) {
T4.transferFocus(); // TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
bloquear();
// TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
// TODO add your handling code here:
}
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
new Inicio().setVisible(true);
// TODO add your handling code here:
}
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
new Javamysql().setVisible(true); // TODO add your handling code here:
}
private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
conectar cc = new conectar();
Connection cn = cc.conexion();
String TIP_CONT,FECH_CONT, TIPPAGO_CONT, COD_CLIE;
String sql="";
TIP_CONT = T1.getText();
FECH_CONT = T2.getText();
TIPPAGO_CONT = T3.getText();
COD_CLIE = T4.getText();
sql = "INSERT INTO contrato (`Tip_cont`,`Fech_cont`,`Tippago_cont`,`Cod_clie`) VALUES (?,?,?,? )";
try {
PreparedStatement pst = cn.prepareStatement(sql);
pst.setString(1, TIP_CONT);
pst.setString(2, FECH_CONT);
pst.setString(3, TIPPAGO_CONT);
pst.setString(4, COD_CLIE);
int a = pst.executeUpdate();
if (a>0){
JOptionPane.showMessageDialog(null ,"Registro Guardado Con exito");
bloquear();
cargar("");
limpiar();
}
} catch (SQLException ex) {
Logger.getLogger(Inmueble.class.getName()).log(Level.SEVERE, null, ex);
}
// TODO add your handling code here:
}
private void auxKeyReleased(java.awt.event.KeyEvent evt) {
cargar(aux.getText()); // TODO add your handling code here:
}
http://www.lawebdelprogramador.com/img/btn_previsualizar.png
En verdad agradecería toto tipo de ayuda
Necesito un favor urgente, este es
Tengo esta interfaz http://sdrv.ms/TErsgi
El programa consta de una conexion entre Java Netbeans y Mysql
tengo 5 campos en las tabla contrato de mysql ya tengo el boyonactualizar y este los muestra en la tabla.
Necesito saber el codigo para poder eliminar por numero contrato (numero contrato tiene auto:incremento en mysql)
Tambien poder ordenar por numero contrato y el boton buscar les agardeceria mucho cualquier tipo de ayuda
ste es el codigo que tengo:
Cree una clase conectar esta es donde llamo la base de datos esta se llama icasaf dentro de esta esta la tabla contrato
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.*;
import java.sql.*;
/**
*
* @author User
*/
public class conectar {
Connection conect = null;
public Connection conexion()
{
try {
Class.forName("org.gjt.mm.mysql.Driver");
conect= DriverManager.getConnection("jdbc:mysql://localhost/icasaf", "root","12345" );
//JOptionPane.showMessageDialog(null, "Conectado");
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error"+e);
}
return conect;
}
}
Este es el codigo que tengo
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
/**
*
* @author User
*/
public class Contrato extends javax.swing.JFrame {
DefaultTableModel model;
/**
* Creates new form Contrato
*/
void cargar(String valor) {
String titulos [] = {"Numero", "Tipo", "Fecha", "T. Pago", "Codigo Cliente"};
String [] registros = new String [5];
String sql = "select*from contrato where N_CONT LIKE '%" +valor+"%'";
model = new DefaultTableModel(null, titulos);
conectar cc=new conectar();
Connection cn = cc.conexion();
try {
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while (rs.next()){
registros[0]=rs.getString("N_CONT");
registros[1]=rs.getString("TIP_CONT");
registros[2]=rs.getString("FECH_CONT");
registros[3]=rs.getString("TIPPAGO_CONT");
registros[4]=rs.getString("COD_CLIE");
model.addRow(registros);
}
t_datos.setModel(model);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
public Contrato() {
initComponents();
limpiar();
bloquear();
cargar("");
}
void limpiar(){
T1.setText("");
T2.setText("");
T3.setText("");
T4.setText("");
}
void bloquear() {
T1.setEnabled(false);
T2.setEnabled(false);
T3.setEnabled(false);
T4.setEnabled(false);
jButton1.setEnabled(true);
b2.setEnabled(false);
jButton3.setEnabled(false);
}
void desbloquear() {
T1.setEnabled(true);
T2.setEnabled(true);
T3.setEnabled(true);
T4.setEnabled(true);
jButton1.setEnabled(false);
b2.setEnabled(true);
jButton3.setEnabled(true);
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
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();
T1 = new javax.swing.JTextField();
T2 = new javax.swing.JTextField();
T3 = new javax.swing.JTextField();
T4 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
b2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
t_datos = new javax.swing.JTable();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
aux = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jButton2 = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(51, 51, 51));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Contrato", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Comic Sans MS", 1, 18), new java.awt.Color(204, 204, 204))); // NOI18N
jPanel1.setForeground(new java.awt.Color(204, 204, 204));
jLabel1.setBackground(new java.awt.Color(51, 51, 51));
jLabel1.setText("Numero:");
jLabel2.setBackground(new java.awt.Color(51, 51, 51));
jLabel2.setText("Tipo:");
jLabel3.setBackground(new java.awt.Color(51, 51, 51));
jLabel3.setText("Fecha:");
jLabel4.setBackground(new java.awt.Color(51, 51, 51));
jLabel4.setText("Tipo De Pago:");
jLabel5.setBackground(new java.awt.Color(51, 51, 51));
jLabel5.setText("Codigo Cliente:");
T1.setBackground(new java.awt.Color(51, 51, 51));
T1.setForeground(new java.awt.Color(204, 204, 204));
T1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T1ActionPerformed(evt);
}
});
T2.setBackground(new java.awt.Color(51, 51, 51));
T2.setForeground(new java.awt.Color(204, 204, 204));
T2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T2ActionPerformed(evt);
}
});
T3.setBackground(new java.awt.Color(51, 51, 51));
T3.setForeground(new java.awt.Color(204, 204, 204));
T3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T3ActionPerformed(evt);
}
});
T4.setBackground(new java.awt.Color(51, 51, 51));
T4.setForeground(new java.awt.Color(204, 204, 204));
T4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
T4ActionPerformed(evt);
}
});
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Agre.png"))); // NOI18N
jButton1.setText("Nuevo");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
b2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Guar.png"))); // NOI18N
b2.setText("Agregar");
b2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b2ActionPerformed(evt);
}
});
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Cancelar.png"))); // NOI18N
jButton3.setText("Cancelar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inmocasaf/Candado.png"))); // NOI18N
jButton4.setText("Salir");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
t_datos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane1.setViewportView(t_datos);
jLabel6.setForeground(new java.awt.Color(0, 153, 153));
jLabel6.setText("Auto_Incremento");
jLabel7.setForeground(new java.awt.Color(0, 102, 102));
jLabel7.setText("__________________________________________________________________________________________");
jLabel8.setForeground(new java.awt.Color(0, 102, 102));
jLabel8.setText("Buscar Por Numero Contrato:");
aux.setBackground(new java.awt.Color(0, 0, 0));
aux.setForeground(new java.awt.Color(0, 102, 102));
aux.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
auxKeyReleased(evt);
}
});
jLabel9.setForeground(new java.awt.Color(0, 102, 102));
jLabel9.setText("Eliminar Por Numero Contaro:");
jTextField6.setBackground(new java.awt.Color(0, 0, 0));
jTextField6.setForeground(new java.awt.Color(0, 102, 102));
jButton5.setText("Eliminar");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jRadioButton1.setBackground(new java.awt.Color(51, 51, 51));
jRadioButton1.setForeground(new java.awt.Color(204, 204, 204));
jRadioButton1.setText("Inicio");
jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
jRadioButton2.setBackground(new java.awt.Color(51, 51, 51));
jRadioButton2.setForeground(new java.awt.Color(204, 204, 204));
jRadioButton2.setText("Opciones Mysql.");
jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
jButton2.setText("Buscar");
jLabel10.setText("Ordenar POr:");
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tipo Contrato", "Numero de Contrato", "Codigo Cliente" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel5))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(T2)
.addComponent(T1)
.addComponent(T4)
.addComponent(T3)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jRadioButton1)
.addGap(18, 18, 18)
.addComponent(jRadioButton2)))
.addGap(47, 47, 47)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(b2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jScrollPane1)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addGap(18, 18, 18)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(aux)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel10)
.addGap(70, 70, 70)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2)
.addGap(0, 0, Short.MAX_VALUE)))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(aux, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(30, 30, 30))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel10)
.addGap(18, 18, 18))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7)
.addGap(3, 3, 3)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel6))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(T1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(T2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(T3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(T4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton1)
.addComponent(jRadioButton2)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(b2, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void T1ActionPerformed(java.awt.event.ActionEvent evt) {
T1.transferFocus();
// TODO add your handling code here:
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
desbloquear();
T1.requestFocus(); // TODO add your handling code here:
}
private void T2ActionPerformed(java.awt.event.ActionEvent evt) {
T2.transferFocus(); // TODO add your handling code here:
}
private void T3ActionPerformed(java.awt.event.ActionEvent evt) {
T3.transferFocus(); // TODO add your handling code here:
}
private void T4ActionPerformed(java.awt.event.ActionEvent evt) {
T4.transferFocus(); // TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
bloquear();
// TODO add your handling code here:
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
// TODO add your handling code here:
}
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
new Inicio().setVisible(true);
// TODO add your handling code here:
}
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
new Javamysql().setVisible(true); // TODO add your handling code here:
}
private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
conectar cc = new conectar();
Connection cn = cc.conexion();
String TIP_CONT,FECH_CONT, TIPPAGO_CONT, COD_CLIE;
String sql="";
TIP_CONT = T1.getText();
FECH_CONT = T2.getText();
TIPPAGO_CONT = T3.getText();
COD_CLIE = T4.getText();
sql = "INSERT INTO contrato (`Tip_cont`,`Fech_cont`,`Tippago_cont`,`Cod_clie`) VALUES (?,?,?,? )";
try {
PreparedStatement pst = cn.prepareStatement(sql);
pst.setString(1, TIP_CONT);
pst.setString(2, FECH_CONT);
pst.setString(3, TIPPAGO_CONT);
pst.setString(4, COD_CLIE);
int a = pst.executeUpdate();
if (a>0){
JOptionPane.showMessageDialog(null ,"Registro Guardado Con exito");
bloquear();
cargar("");
limpiar();
}
} catch (SQLException ex) {
Logger.getLogger(Inmueble.class.getName()).log(Level.SEVERE, null, ex);
}
// TODO add your handling code here:
}
private void auxKeyReleased(java.awt.event.KeyEvent evt) {
cargar(aux.getText()); // TODO add your handling code here:
}
http://www.lawebdelprogramador.com/img/btn_previsualizar.png
En verdad agradecería toto tipo de ayuda
Valora esta pregunta


0