title: java.lang.UnsupportedOperationException: Not supported yet
body: <p>I always get this error when I try to run my program. It is frustrating because this program is due tomorrow. This is the error:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not supported yet.
  at trial.connection.returndata(connection.java:22)
  at trial.search.jTextField1KeyReleased(search.java:150)
  at trial.search.access$000(search.java:21)
  at trial.search$1.keyReleased(search.java:100)
  at java.awt.Component.processKeyEvent(Component.java:6466)
  at javax.swing.JComponent.processKeyEvent(JComponent.java:2828)
  at java.awt.Component.processEvent(Component.java:6282)
  at java.awt.Container.processEvent(Container.java:2229)
  at java.awt.Component.dispatchEventImpl(Component.java:4861)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)
  at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)
  at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)
  at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899)
  at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727)
  at java.awt.Component.dispatchEventImpl(Component.java:4731)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Window.dispatchEventImpl(Window.java:2719)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
  at java.awt.EventQueue.access$200(EventQueue.java:103)
  at java.awt.EventQueue$3.run(EventQueue.java:694)
  at java.awt.EventQueue$3.run(EventQueue.java:692)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
  at java.awt.EventQueue$4.run(EventQueue.java:708)
  at java.awt.EventQueue$4.run(EventQueue.java:706)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
  Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not supported yet.
  at trial.connection.returndata(connection.java:22)
  at trial.search.jTextField1KeyReleased(search.java:150)
  at trial.search.access$000(search.java:21)
  at trial.search$1.keyReleased(search.java:100)
  at java.awt.Component.processKeyEvent(Component.java:6466)
  at javax.swing.JComponent.processKeyEvent(JComponent.java:2828)
  at java.awt.Component.processEvent(Component.java:6282)
  at java.awt.Container.processEvent(Container.java:2229)
  at java.awt.Component.dispatchEventImpl(Component.java:4861)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)
  at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)
  at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)
  at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899)
  at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727)
  at java.awt.Component.dispatchEventImpl(Component.java:4731)
  at java.awt.Container.dispatchEventImpl(Container.java:2287)
  at java.awt.Window.dispatchEventImpl(Window.java:2719)
  at java.awt.Component.dispatchEvent(Component.java:4687)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
  at java.awt.EventQueue.access$200(EventQueue.java:103)
  at java.awt.EventQueue$3.run(EventQueue.java:694)
  at java.awt.EventQueue$3.run(EventQueue.java:692)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
  at java.awt.EventQueue$4.run(EventQueue.java:708)
  at java.awt.EventQueue$4.run(EventQueue.java:706)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
  </code></pre>
  
  <p>This is the whole code from the frame that I'm currently working on:</p>
  
  <pre><code>package trial;
  
  import java.awt.HeadlessException;
  import java.sql.SQLException;
  import java.sql.*;
  import java.sql.Connection;
  import java.sql.ResultSet;
  import java.sql.Statement;
  import javax.swing.table.DefaultTableModel;
  import javax.swing.JOptionPane;
  
  public class search extends javax.swing.JFrame {
  static Connection connection;
  static String url;
  static Statement st;
  static ResultSet rs;
  
  Connection myconnection;
  Statement stStatement;
  Statement stLogin;
  ResultSet rsData;
  PreparedStatement psPreparedStatement;
  
  /**
   * Creates new form search
   */
  public search() {
      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")
  
  // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;                          
  private void initComponents() {
  
      jScrollPane1 = new javax.swing.JScrollPane();
      medrec_table = new javax.swing.JTable();
      jLabel1 = new javax.swing.JLabel();
      jTextField1 = new javax.swing.JTextField();
  
      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  
      medrec_table.setModel(new javax.swing.table.DefaultTableModel(
          new Object [][] {
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null},
              {null, null, null, null, null, null, null}
          },
          new String [] {
              "Student ID", "Date", "Last Name", "First Name", "Middle Name", "Ailment", "Remarks"
          }
      ));
      jScrollPane1.setViewportView(medrec_table);
  
      jLabel1.setText("Search for Medical Records");
  
      jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
          public void keyReleased(java.awt.event.KeyEvent evt) {
              jTextField1KeyReleased(evt);
          }
      });
  
      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
              .addGap(18, 18, 18)
              .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 678, Short.MAX_VALUE)
              .addGap(50, 50, 50)
              .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                      .addComponent(jLabel1)
                      .addGap(21, 21, 21))
                  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                      .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addContainerGap())))
      );
      layout.setVerticalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
              .addContainerGap()
              .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                  .addGroup(layout.createSequentialGroup()
                      .addComponent(jLabel1)
                      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                      .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addGap(0, 0, Short.MAX_VALUE))
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
              .addContainerGap())
      );
  
      pack();
  }// &lt;/editor-fold&gt;                        
  public ResultSet consulta(String sql) throws SQLException
  {
      try {
          rsData=stStatement.executeQuery(sql); 
      } catch (SQLException ex) {
          throw ex;
      }
      return rsData;
  }
  private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {                                        
  try {
  
      connection c = new connection();
      DefaultTableModel T;
      T= c.returndata("Select * From medrec Where student_no=?");
  medrec_table.setModel(T);
      jScrollPane1.getViewport().add(medrec_table);
      } 
  
   catch(HeadlessException e) {
          JOptionPane.showMessageDialog(null,e);
          //  Logger.getLogger(log.class.getName()).log(Level.SEVERE, null, ex);     
       }
  }                                       
  
  /**
   * @param args the command line arguments
   */
  public static void main(String args[]) {
      /* Set the Nimbus look and feel */
      //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt;
      /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
       * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
       */
      try {
          for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
              if ("Nimbus".equals(info.getName())) {
                  javax.swing.UIManager.setLookAndFeel(info.getClassName());
                  break;
              }
          }
      } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
          java.util.logging.Logger.getLogger(search.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
      }
      //&lt;/editor-fold&gt;
  
      //&lt;/editor-fold&gt;
  
      /* Create and display the form */
      java.awt.EventQueue.invokeLater(new Runnable() {
          @Override
          public void run() {
              new search().setVisible(true);
          }
      });
  }
  
  // Variables declaration - do not modify                     
  private javax.swing.JLabel jLabel1;
  private javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JTextField jTextField1;
  private javax.swing.JTable medrec_table;
  // End of variables declaration                   
  }
  </code></pre>