@author Leandro
*/
public class DR_SOFT_JAVA_CONSULTORIOS extends javax.swing.JFrame {
/** Creates new form DR_SOFT_JAVA_CONSULTORIOS */
public DR_SOFT_JAVA_CONSULTORIOS() {
initComponents();
setSize(953,665);
setLocation(35,54);
setDefaultCloseOperation(DR_SOFT_JAVA_CONSULTORIOS.HIDE_ON_CLOSE);
}
/** 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.
*/
// //GEN-BEGIN:initComponents
private void initComponents() {
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jTextField2 = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setFont(new java.awt.Font(“Arial”, 1, 12));
jButton1.setText("<<");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font(“Arial”, 1, 12));
jButton2.setText("<");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setFont(new java.awt.Font(“Arial”, 1, 12));
jButton3.setText(">");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setFont(new java.awt.Font(“Arial”, 1, 12));
jButton4.setText(">>");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(67, 67, 67)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 202, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 208, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(layout.createSequentialGroup()
.add(138, 138, 138)
.add(jButton1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton4)))
.addContainerGap(123, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(223, 223, 223)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton1)
.add(jButton2)
.add(jButton3)
.add(jButton4))
.addContainerGap(24, Short.MAX_VALUE))
);
pack();
}// //GEN-END:initComponents
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
DBCONNECTION conn = new DBCONNECTION();
RowSet rs = null;
try {
rs = conn.excuteQuery(“select * from CONSULTORIOS”);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
try {
rs.last();
} catch (SQLException ex) {
ex.printStackTrace();
}
String razao = null;
String fantasia = null;
try {
fantasia = rs.getString(“nome_fantasia”);
jTextField2.setText(fantasia);
razao = rs.getString(“razao_social”);
jTextField1.setText(razao);
} catch (SQLException ex) {
ex.printStackTrace();
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
DBCONNECTION conn = new DBCONNECTION();
RowSet rs = null;
try {
rs = conn.excuteQuery(“select * from CONSULTORIOS”);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
try {
if (rs.isLast()){
return;
}
rs.next();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,"THERE ARE NOT A NEXT 1 "+ex.getMessage());
}
String razao = null;
String fantasia = null;
try {
fantasia = rs.getString("nome_fantasia");
jTextField2.setText(fantasia);
razao = rs.getString("razao_social");
jTextField1.setText(razao);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,"THERE ARE NOT A NEXT 1 "+ex.getMessage());
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
DBCONNECTION conn = new DBCONNECTION();
RowSet rs = null;
try {
rs = conn.excuteQuery(“select * from CONSULTORIOS”);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
try {
if(rs.isFirst()){
return;
}
rs.previous();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,"THERE ARE NOT A PREVIOUS 1 "+ex.getMessage());
}
String razao = null;
String fantasia = null;
try {
fantasia = rs.getString("nome_fantasia");
jTextField2.setText(fantasia);
razao = rs.getString("razao_social");
jTextField1.setText(razao);
} catch (SQLException ex) {
// throw new IllegalStateException("THERE ARE NOT A PREVIOUS", ex);
JOptionPane.showMessageDialog(this,"THERE ARE NOT A PREVIOUS"+ex.getMessage());
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
DBCONNECTION conn = new DBCONNECTION();
RowSet rs = null;
try {
rs = conn.excuteQuery(“select * from CONSULTORIOS”);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
try {
rs.first();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,"THERE STILL IN THE FIRST "+ex.getMessage());
}
String razao = null;
String fantasia = null;
try {
fantasia = rs.getString(“nome_fantasia”);
jTextField2.setText(fantasia);
razao = rs.getString(“razao_social”);
jTextField1.setText(razao);
} catch (SQLException ex) {
ex.printStackTrace();
}
}//GEN-LAST:event_jButton1ActionPerformed
private Connection con = null;
/**
-
@param args the command line arguments
*/
public static void main(String args[]) throws ClassNotFoundException, SQLException {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DR_SOFT_JAVA_CONSULTORIOS().setVisible(true);
}
});
DBCONNECTION conn = new DBCONNECTION();
RowSet rs = conn.excuteQuery(“select * from CONSULTORIOS”);
rs.first();
}
private void PrepareStatement(ResultSet rs, int TYPE_SCROLL_SENSITIVE, int CONCUR_UPDATABLE) {
throw new UnsupportedOperationException(“Not yet implemented”);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables