Advertisement
rootUser

[DB][3.1] MemorySearch.java (SSMS)

Jan 28th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 25.17 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package diary;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import java.sql.ResultSet;
  11. import java.sql.SQLException;
  12. import java.sql.Statement;
  13. import javax.swing.JOptionPane;
  14. import javax.swing.table.DefaultTableModel;
  15.  
  16. /**
  17.  *
  18.  * @author root
  19.  */
  20. public class MemorySearch extends javax.swing.JFrame
  21. {
  22.  
  23.     public String[] searchParameters = new String[]
  24.     {"(Select a parameter)","NAME","PLACE","DESCRIPTION"};
  25.     /**
  26.      * Creates new form Search
  27.      */
  28.     public MemorySearch()
  29.     {
  30.         initComponents();
  31.         getContentPane().setBackground(java.awt.Color.gray);
  32.         searchParameterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(searchParameters));
  33.     }
  34.  
  35.     /**
  36.      * This method is called from within the constructor to initialize the form.
  37.      * WARNING: Do NOT modify this code. The content of this method is always
  38.      * regenerated by the Form Editor.
  39.      */
  40.     @SuppressWarnings("unchecked")
  41.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  42.     private void initComponents()
  43.     {
  44.  
  45.         searchLabel = new javax.swing.JLabel();
  46.         searchParameterLabel = new javax.swing.JLabel();
  47.         searchParameterComboBox = new javax.swing.JComboBox<>();
  48.         searchButton = new javax.swing.JButton();
  49.         resultScrollPane = new javax.swing.JScrollPane();
  50.         resultTable = new javax.swing.JTable();
  51.         inputPromptLabel = new javax.swing.JLabel();
  52.         memoryIDLabel = new javax.swing.JLabel();
  53.         memoryIDTextField = new javax.swing.JTextField();
  54.         goButton = new javax.swing.JButton();
  55.         backToMenuButton = new javax.swing.JButton();
  56.         backToOtherMemoryButton = new javax.swing.JButton();
  57.         exitButton = new javax.swing.JButton();
  58.         searchScrollPane = new javax.swing.JScrollPane();
  59.         searchTextArea = new javax.swing.JTextArea();
  60.         stringToSearchLabel = new javax.swing.JLabel();
  61.         searchResultLabel = new javax.swing.JLabel();
  62.  
  63.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  64.  
  65.         searchLabel.setBackground(new java.awt.Color(0, 0, 0));
  66.         searchLabel.setFont(new java.awt.Font("Lucida Handwriting", 1, 12)); // NOI18N
  67.         searchLabel.setForeground(new java.awt.Color(255, 102, 0));
  68.         searchLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  69.         searchLabel.setText("SEARCH");
  70.  
  71.         searchParameterLabel.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  72.         searchParameterLabel.setForeground(new java.awt.Color(0, 255, 0));
  73.         searchParameterLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  74.         searchParameterLabel.setText("SELECT SEARCH PARAMETER :");
  75.  
  76.         searchParameterComboBox.setBackground(new java.awt.Color(255, 255, 0));
  77.         searchParameterComboBox.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  78.         searchParameterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " " }));
  79.  
  80.         searchButton.setBackground(new java.awt.Color(0, 0, 0));
  81.         searchButton.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  82.         searchButton.setForeground(new java.awt.Color(0, 255, 0));
  83.         searchButton.setText("SEARCH");
  84.         searchButton.addActionListener(new java.awt.event.ActionListener()
  85.         {
  86.             public void actionPerformed(java.awt.event.ActionEvent evt)
  87.             {
  88.                 searchButtonActionPerformed(evt);
  89.             }
  90.         });
  91.  
  92.         resultScrollPane.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  93.  
  94.         resultTable.setModel(new javax.swing.table.DefaultTableModel(
  95.                                  new Object [][]
  96.         {
  97.  
  98.         },
  99.         new String []
  100.         {
  101.             "memoryID", "searchResult"
  102.         }
  103.                              ));
  104.         resultScrollPane.setViewportView(resultTable);
  105.  
  106.         inputPromptLabel.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  107.         inputPromptLabel.setForeground(new java.awt.Color(0, 255, 255));
  108.         inputPromptLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  109.         inputPromptLabel.setText("INPUT 'MEMORY ID' BELOW FROM ABOVE TABLE FOR DETAILS");
  110.  
  111.         memoryIDLabel.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  112.         memoryIDLabel.setForeground(new java.awt.Color(255, 255, 0));
  113.         memoryIDLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  114.         memoryIDLabel.setText("MEMORY ID :");
  115.  
  116.         memoryIDTextField.setBackground(new java.awt.Color(0, 0, 0));
  117.         memoryIDTextField.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  118.         memoryIDTextField.setForeground(new java.awt.Color(0, 255, 0));
  119.         memoryIDTextField.addActionListener(new java.awt.event.ActionListener()
  120.         {
  121.             public void actionPerformed(java.awt.event.ActionEvent evt)
  122.             {
  123.                 memoryIDTextFieldActionPerformed(evt);
  124.             }
  125.         });
  126.  
  127.         goButton.setBackground(new java.awt.Color(0, 0, 0));
  128.         goButton.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  129.         goButton.setForeground(new java.awt.Color(0, 255, 0));
  130.         goButton.setText("GO");
  131.         goButton.addActionListener(new java.awt.event.ActionListener()
  132.         {
  133.             public void actionPerformed(java.awt.event.ActionEvent evt)
  134.             {
  135.                 goButtonActionPerformed(evt);
  136.             }
  137.         });
  138.  
  139.         backToMenuButton.setBackground(new java.awt.Color(0, 0, 0));
  140.         backToMenuButton.setFont(new java.awt.Font("sansserif", 1, 12)); // NOI18N
  141.         backToMenuButton.setForeground(new java.awt.Color(0, 255, 0));
  142.         backToMenuButton.setText("BACK TO MENU");
  143.         backToMenuButton.addActionListener(new java.awt.event.ActionListener()
  144.         {
  145.             public void actionPerformed(java.awt.event.ActionEvent evt)
  146.             {
  147.                 backToMenuButtonActionPerformed(evt);
  148.             }
  149.         });
  150.  
  151.         backToOtherMemoryButton.setBackground(new java.awt.Color(0, 0, 0));
  152.         backToOtherMemoryButton.setFont(new java.awt.Font("sansserif", 1, 12)); // NOI18N
  153.         backToOtherMemoryButton.setForeground(new java.awt.Color(0, 255, 0));
  154.         backToOtherMemoryButton.setText("BACK TO OTHER MEMORIES");
  155.         backToOtherMemoryButton.addActionListener(new java.awt.event.ActionListener()
  156.         {
  157.             public void actionPerformed(java.awt.event.ActionEvent evt)
  158.             {
  159.                 backToOtherMemoryButtonActionPerformed(evt);
  160.             }
  161.         });
  162.  
  163.         exitButton.setBackground(new java.awt.Color(0, 0, 0));
  164.         exitButton.setFont(new java.awt.Font("sansserif", 1, 12)); // NOI18N
  165.         exitButton.setForeground(new java.awt.Color(0, 255, 0));
  166.         exitButton.setText("EXIT");
  167.         exitButton.addActionListener(new java.awt.event.ActionListener()
  168.         {
  169.             public void actionPerformed(java.awt.event.ActionEvent evt)
  170.             {
  171.                 exitButtonActionPerformed(evt);
  172.             }
  173.         });
  174.  
  175.         searchTextArea.setBackground(new java.awt.Color(0, 0, 0));
  176.         searchTextArea.setColumns(20);
  177.         searchTextArea.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  178.         searchTextArea.setForeground(new java.awt.Color(0, 255, 0));
  179.         searchTextArea.setRows(5);
  180.         searchScrollPane.setViewportView(searchTextArea);
  181.  
  182.         stringToSearchLabel.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  183.         stringToSearchLabel.setForeground(new java.awt.Color(0, 255, 0));
  184.         stringToSearchLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  185.         stringToSearchLabel.setText("ENTER STRING TO SEARCH :");
  186.  
  187.         searchResultLabel.setFont(new java.awt.Font("Lucida Console", 1, 12)); // NOI18N
  188.         searchResultLabel.setForeground(new java.awt.Color(0, 255, 255));
  189.         searchResultLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  190.         searchResultLabel.setText("SEARCH RESULT :");
  191.  
  192.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  193.         getContentPane().setLayout(layout);
  194.         layout.setHorizontalGroup(
  195.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  196.             .addGroup(layout.createSequentialGroup()
  197.                       .addContainerGap()
  198.                       .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  199.                                 .addComponent(searchResultLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  200.                                 .addComponent(stringToSearchLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  201.                                 .addComponent(searchLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  202.                                 .addComponent(searchParameterLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  203.                                 .addComponent(searchParameterComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  204.                                 .addComponent(searchButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  205.                                 .addComponent(inputPromptLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  206.                                 .addComponent(searchScrollPane)
  207.                                 .addComponent(resultScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
  208.                                 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  209.                                           .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  210.                                                   .addComponent(exitButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  211.                                                   .addGroup(layout.createSequentialGroup()
  212.                                                           .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  213.                                                                   .addComponent(memoryIDLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  214.                                                                   .addComponent(backToMenuButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  215.                                                           .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  216.                                                                   .addGroup(layout.createSequentialGroup()
  217.                                                                           .addGap(18, 18, 18)
  218.                                                                           .addComponent(backToOtherMemoryButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  219.                                                                   .addGroup(layout.createSequentialGroup()
  220.                                                                           .addGap(8, 8, 8)
  221.                                                                           .addComponent(memoryIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
  222.                                                                           .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  223.                                                                           .addComponent(goButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)))))
  224.                                           .addGap(12, 12, 12)))
  225.                       .addContainerGap())
  226.         );
  227.         layout.setVerticalGroup(
  228.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  229.             .addGroup(layout.createSequentialGroup()
  230.                       .addContainerGap()
  231.                       .addComponent(searchLabel)
  232.                       .addGap(18, 18, 18)
  233.                       .addComponent(searchParameterLabel)
  234.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  235.                       .addComponent(searchParameterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  236.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  237.                       .addComponent(stringToSearchLabel)
  238.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  239.                       .addComponent(searchScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  240.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  241.                       .addComponent(searchButton)
  242.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  243.                       .addComponent(searchResultLabel)
  244.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  245.                       .addComponent(resultScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
  246.                       .addGap(18, 18, 18)
  247.                       .addComponent(inputPromptLabel)
  248.                       .addGap(18, 18, 18)
  249.                       .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  250.                                 .addComponent(memoryIDTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
  251.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  252.                                           .addComponent(goButton)
  253.                                           .addComponent(memoryIDLabel)))
  254.                       .addGap(18, 18, 18)
  255.                       .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  256.                                 .addComponent(backToMenuButton)
  257.                                 .addComponent(backToOtherMemoryButton))
  258.                       .addGap(18, 18, 18)
  259.                       .addComponent(exitButton)
  260.                       .addContainerGap(26, Short.MAX_VALUE))
  261.         );
  262.  
  263.         pack();
  264.         setLocationRelativeTo(null);
  265.     }// </editor-fold>
  266.  
  267.     private void exitButtonActionPerformed(java.awt.event.ActionEvent evt)
  268.     {
  269.         // TODO add your handling code here:
  270.         System.exit(0);
  271.     }
  272.  
  273.     private void backToOtherMemoryButtonActionPerformed(java.awt.event.ActionEvent evt)
  274.     {
  275.         // TODO add your handling code here
  276.         this.setVisible(false);
  277.         MemoryIndex memoryIndex = new MemoryIndex();
  278.         memoryIndex.setVisible(true);
  279.     }
  280.  
  281.     private void backToMenuButtonActionPerformed(java.awt.event.ActionEvent evt)
  282.     {
  283.         // TODO add your handling code here:
  284.         this.setVisible(false);
  285.         Menu menu = new Menu();
  286.         menu.setVisible(true);
  287.     }
  288.  
  289.     private void goButtonActionPerformed(java.awt.event.ActionEvent evt)
  290.     {
  291.         // TODO add your handling code here:
  292.         int memoryID = Integer.parseInt(memoryIDTextField.getText());
  293.         this.setVisible(false);
  294.         MemoryDetails memoryDetails = new MemoryDetails(memoryID);
  295.         memoryDetails.setVisible(true);
  296.     }
  297.  
  298.     private void searchButtonActionPerformed(java.awt.event.ActionEvent evt)
  299.     {
  300.         // TODO add your handling code here:
  301.  
  302.         String driver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
  303.         String host = "jdbc:sqlserver://localhost:61271";
  304.         String username = "sa";
  305.         String password = "alvi";
  306.         try
  307.         {
  308.             //connect database and fetch result
  309.             Class.forName(driver);
  310.             Connection connection = DriverManager.getConnection(host, username, password);
  311.             Statement statement = connection.createStatement();
  312.  
  313.             String searchType = searchParameterComboBox.getSelectedItem().toString();
  314.             String searchItem = searchTextArea.getText();
  315.  
  316.             if(searchType.equals("NAME"))
  317.             {
  318.                 ResultSet resultSet = statement.executeQuery
  319.                                       ("SELECT * FROM diary.dbo.memoryAll " +
  320.                                        "    JOIN diary.dbo.memoryMoment " +
  321.                                        "    ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryMoment.MEMORYID " +
  322.                                        "        JOIN diary.dbo.memoryPlace " +
  323.                                        "         ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryPlace.MEMORYID " +
  324.                                        "            JOIN diary.dbo.memoryDescription " +
  325.                                        "            ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryDescription.MEMORYID "+
  326.                                        "WHERE memoryName LIKE '%"+searchItem+"%'");
  327.                 //add row to table - according to result
  328.                 DefaultTableModel defaultTableModel = (DefaultTableModel) resultTable.getModel();
  329.                 while(resultSet.next())
  330.                 {
  331.                     //System.out.println(resultSet.toString());
  332.                     int memoryID = resultSet.getInt("memoryID");
  333.                     String memoryName = resultSet.getString("memoryName");
  334.                     //System.out.println(memoryID+"\n"+memoryDescription);
  335.                     defaultTableModel.addRow(new Object[] {memoryID,memoryName});
  336.                 }
  337.                 resultSet.close();
  338.             }
  339.             else if(searchType.equals("PLACE"))
  340.             {
  341.                 ResultSet resultSet = statement.executeQuery
  342.                                       ("SELECT * FROM diary.dbo.memoryAll " +
  343.                                        "    JOIN diary.dbo.memoryMoment " +
  344.                                        "    ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryMoment.MEMORYID " +
  345.                                        "        JOIN diary.dbo.memoryPlace " +
  346.                                        "         ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryPlace.MEMORYID " +
  347.                                        "            JOIN diary.dbo.memoryDescription " +
  348.                                        "            ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryDescription.MEMORYID "+
  349.                                        "WHERE memoryPlaceName LIKE '%"+searchItem+"%'");
  350.                 //add row to table - according to result
  351.                 DefaultTableModel defaultTableModel = (DefaultTableModel) resultTable.getModel();
  352.                 while(resultSet.next())
  353.                 {
  354.                     //System.out.println(resultSet.toString());
  355.                     int memoryID = resultSet.getInt("memoryID");
  356.                     String memoryPlace = resultSet.getString("memoryPlaceName");
  357.                     //System.out.println(memoryID+"\n"+memoryDescription);
  358.                     defaultTableModel.addRow(new Object[] {memoryID,memoryPlace});
  359.                 }
  360.                 resultSet.close();
  361.             }
  362.             else if(searchType.equals("DESCRIPTION"))
  363.             {
  364.                 ResultSet resultSet = statement.executeQuery
  365.                                       ("SELECT * FROM diary.dbo.memoryAll " +
  366.                                        "    JOIN diary.dbo.memoryMoment " +
  367.                                        "    ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryMoment.MEMORYID " +
  368.                                        "        JOIN diary.dbo.memoryPlace " +
  369.                                        "         ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryPlace.MEMORYID " +
  370.                                        "            JOIN diary.dbo.memoryDescription " +
  371.                                        "            ON diary.dbo.memoryAll.MEMORYID=diary.dbo.memoryDescription.MEMORYID "+
  372.                                        "WHERE memoryDescriptionFull LIKE '%"+searchItem+"%'");
  373.                 //add row to table - according to result
  374.                 DefaultTableModel defaultTableModel = (DefaultTableModel) resultTable.getModel();
  375.                 while(resultSet.next())
  376.                 {
  377.                     //System.out.println(resultSet.toString());
  378.                     int memoryID = resultSet.getInt("memoryID");
  379.                     String memoryDescription = resultSet.getString("memoryDescriptionFull");
  380.                     //System.out.println(memoryID+"\n"+memoryDescription);
  381.                     defaultTableModel.addRow(new Object[] {memoryID,memoryDescription});
  382.                 }
  383.                 resultSet.close();
  384.             }
  385.             statement.close();
  386.             connection.close();
  387.         }
  388.         catch(SQLException sqlException)
  389.         {
  390.             sqlException.printStackTrace();
  391.             JOptionPane.showMessageDialog
  392.             (this,
  393.              "Error code : "+sqlException.getErrorCode()+"\n"+
  394.              "Error message : "+sqlException.getMessage()+"\n"+
  395.              "SQL state : "+sqlException.getSQLState()+"\n"
  396.             );
  397.         }
  398.         catch (ClassNotFoundException classNotFoundException)
  399.         {
  400.             classNotFoundException.printStackTrace();
  401.             JOptionPane.showMessageDialog
  402.             (this,
  403.              "Error message : "+classNotFoundException.getMessage()+"\n"
  404.             );
  405.         }
  406.     }
  407.  
  408.     private void memoryIDTextFieldActionPerformed(java.awt.event.ActionEvent evt)
  409.     {
  410.         // TODO add your handling code here:
  411.     }
  412.  
  413.     /**
  414.      * @param args the command line arguments
  415.      */
  416.     public static void main(String args[])
  417.     {
  418.         /* Set the Nimbus look and feel */
  419.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  420.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  421.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  422.          */
  423.         try
  424.         {
  425.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
  426.             {
  427.                 if ("Nimbus".equals(info.getName()))
  428.                 {
  429.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  430.                     break;
  431.                 }
  432.             }
  433.         }
  434.         catch (ClassNotFoundException ex)
  435.         {
  436.             java.util.logging.Logger.getLogger(MemorySearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  437.         }
  438.         catch (InstantiationException ex)
  439.         {
  440.             java.util.logging.Logger.getLogger(MemorySearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  441.         }
  442.         catch (IllegalAccessException ex)
  443.         {
  444.             java.util.logging.Logger.getLogger(MemorySearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  445.         }
  446.         catch (javax.swing.UnsupportedLookAndFeelException ex)
  447.         {
  448.             java.util.logging.Logger.getLogger(MemorySearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  449.         }
  450.         //</editor-fold>
  451.         //</editor-fold>
  452.  
  453.         /* Create and display the form */
  454.         java.awt.EventQueue.invokeLater(new Runnable()
  455.         {
  456.             public void run()
  457.             {
  458.                 new MemorySearch().setVisible(true);
  459.             }
  460.         });
  461.     }
  462.  
  463.     // Variables declaration - do not modify
  464.     private javax.swing.JButton backToMenuButton;
  465.     private javax.swing.JButton backToOtherMemoryButton;
  466.     private javax.swing.JButton exitButton;
  467.     private javax.swing.JButton goButton;
  468.     private javax.swing.JLabel inputPromptLabel;
  469.     private javax.swing.JLabel memoryIDLabel;
  470.     private javax.swing.JTextField memoryIDTextField;
  471.     private javax.swing.JScrollPane resultScrollPane;
  472.     private javax.swing.JTable resultTable;
  473.     private javax.swing.JButton searchButton;
  474.     private javax.swing.JLabel searchLabel;
  475.     private javax.swing.JComboBox<String> searchParameterComboBox;
  476.     private javax.swing.JLabel searchParameterLabel;
  477.     private javax.swing.JLabel searchResultLabel;
  478.     private javax.swing.JScrollPane searchScrollPane;
  479.     private javax.swing.JTextArea searchTextArea;
  480.     private javax.swing.JLabel stringToSearchLabel;
  481.     // End of variables declaration
  482. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement