Advertisement
rootUser

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

Jan 28th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 14.01 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.awt.Color;
  9.  
  10. /**
  11.  *
  12.  * @author root
  13.  */
  14. public class Menu extends javax.swing.JFrame
  15. {
  16.  
  17.     /**
  18.      * Creates new form Menu
  19.      */
  20.  
  21.     public Menu()
  22.     {
  23.         initComponents();
  24.         getContentPane().setBackground(Color.BLACK);
  25.         makeAllRadioButtonsUnset();
  26.     }
  27.  
  28.     public void makeAllRadioButtonsUnset()
  29.     {
  30.         displayRadioButton.setSelected(false);
  31.         insertRadioButton.setSelected(false);
  32.         updateRadioButton.setSelected(false);
  33.         deleteRadioButton.setSelected(false);
  34.         searchRadioButton.setSelected(false);
  35.     }
  36.     /*
  37.     public void makeOtherRadioButtonsUnset()
  38.     {
  39.         if(displayRadioButton.isSelected())
  40.         {
  41.             //displayRadioButton.setSelected(false);
  42.             insertRadioButton.setSelected(false);
  43.             updateRadioButton.setSelected(false);
  44.             deleteRadioButton.setSelected(false);
  45.             searchRadioButton.setSelected(false);
  46.         }
  47.         else if(insertRadioButton.isSelected())
  48.         {
  49.             displayRadioButton.setSelected(false);
  50.             //insertRadioButton.setSelected(false);
  51.             updateRadioButton.setSelected(false);
  52.             deleteRadioButton.setSelected(false);
  53.             searchRadioButton.setSelected(false);
  54.         }
  55.         else if(updateRadioButton.isSelected())
  56.         {
  57.             displayRadioButton.setSelected(false);
  58.             insertRadioButton.setSelected(false);
  59.             //updateRadioButton.setSelected(false);
  60.             deleteRadioButton.setSelected(false);
  61.             searchRadioButton.setSelected(false);
  62.         }
  63.         else if(deleteRadioButton.isSelected())
  64.         {
  65.             displayRadioButton.setSelected(false);
  66.             insertRadioButton.setSelected(false);
  67.             updateRadioButton.setSelected(false);
  68.             //deleteRadioButton.setSelected(false);
  69.             searchRadioButton.setSelected(false);
  70.         }
  71.         else if(searchRadioButton.isSelected())
  72.         {
  73.             displayRadioButton.setSelected(false);
  74.             insertRadioButton.setSelected(false);
  75.             updateRadioButton.setSelected(false);
  76.             deleteRadioButton.setSelected(false);
  77.             //searchRadioButton.setSelected(false);
  78.         }
  79.     }
  80.     */
  81.  
  82.     /**
  83.      * This method is called from within the constructor to initialize the form.
  84.      * WARNING: Do NOT modify this code. The content of this method is always
  85.      * regenerated by the Form Editor.
  86.      */
  87.     @SuppressWarnings("unchecked")
  88.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  89.     private void initComponents()
  90.     {
  91.  
  92.         menuLabel = new javax.swing.JLabel();
  93.         displayRadioButton = new javax.swing.JRadioButton();
  94.         insertRadioButton = new javax.swing.JRadioButton();
  95.         deleteRadioButton = new javax.swing.JRadioButton();
  96.         updateRadioButton = new javax.swing.JRadioButton();
  97.         searchRadioButton = new javax.swing.JRadioButton();
  98.         exitButton = new javax.swing.JButton();
  99.  
  100.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  101.  
  102.         menuLabel.setBackground(new java.awt.Color(51, 51, 51));
  103.         menuLabel.setFont(new java.awt.Font("Kristen ITC", 1, 12)); // NOI18N
  104.         menuLabel.setForeground(new java.awt.Color(0, 153, 255));
  105.         menuLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  106.         menuLabel.setText("MENU");
  107.  
  108.         displayRadioButton.setBackground(new java.awt.Color(51, 51, 51));
  109.         displayRadioButton.setFont(new java.awt.Font("Lucida Handwriting", 1, 12)); // NOI18N
  110.         displayRadioButton.setForeground(new java.awt.Color(255, 0, 102));
  111.         displayRadioButton.setText("DISPLAY MEMORY");
  112.         displayRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  113.         displayRadioButton.addActionListener(new java.awt.event.ActionListener()
  114.         {
  115.             public void actionPerformed(java.awt.event.ActionEvent evt)
  116.             {
  117.                 displayRadioButtonActionPerformed(evt);
  118.             }
  119.         });
  120.  
  121.         insertRadioButton.setBackground(new java.awt.Color(51, 51, 51));
  122.         insertRadioButton.setFont(new java.awt.Font("Lucida Handwriting", 1, 12)); // NOI18N
  123.         insertRadioButton.setForeground(new java.awt.Color(51, 204, 0));
  124.         insertRadioButton.setText("INSERT MEMORY");
  125.         insertRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  126.         insertRadioButton.addActionListener(new java.awt.event.ActionListener()
  127.         {
  128.             public void actionPerformed(java.awt.event.ActionEvent evt)
  129.             {
  130.                 insertRadioButtonActionPerformed(evt);
  131.             }
  132.         });
  133.  
  134.         deleteRadioButton.setBackground(new java.awt.Color(51, 51, 51));
  135.         deleteRadioButton.setFont(new java.awt.Font("Lucida Handwriting", 1, 12)); // NOI18N
  136.         deleteRadioButton.setForeground(new java.awt.Color(0, 255, 255));
  137.         deleteRadioButton.setText("DELETE MEMORY");
  138.         deleteRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  139.         deleteRadioButton.addActionListener(new java.awt.event.ActionListener()
  140.         {
  141.             public void actionPerformed(java.awt.event.ActionEvent evt)
  142.             {
  143.                 deleteRadioButtonActionPerformed(evt);
  144.             }
  145.         });
  146.  
  147.         updateRadioButton.setBackground(new java.awt.Color(51, 51, 51));
  148.         updateRadioButton.setFont(new java.awt.Font("Lucida Handwriting", 1, 12)); // NOI18N
  149.         updateRadioButton.setForeground(new java.awt.Color(255, 0, 255));
  150.         updateRadioButton.setText("UPDATE MEMORY");
  151.         updateRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  152.         updateRadioButton.addActionListener(new java.awt.event.ActionListener()
  153.         {
  154.             public void actionPerformed(java.awt.event.ActionEvent evt)
  155.             {
  156.                 updateRadioButtonActionPerformed(evt);
  157.             }
  158.         });
  159.  
  160.         searchRadioButton.setBackground(new java.awt.Color(51, 51, 51));
  161.         searchRadioButton.setFont(new java.awt.Font("Lucida Handwriting", 1, 12)); // NOI18N
  162.         searchRadioButton.setForeground(new java.awt.Color(255, 153, 0));
  163.         searchRadioButton.setText("SEARCH MEMORY");
  164.         searchRadioButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  165.         searchRadioButton.addActionListener(new java.awt.event.ActionListener()
  166.         {
  167.             public void actionPerformed(java.awt.event.ActionEvent evt)
  168.             {
  169.                 searchRadioButtonActionPerformed(evt);
  170.             }
  171.         });
  172.  
  173.         exitButton.setBackground(new java.awt.Color(51, 51, 51));
  174.         exitButton.setFont(new java.awt.Font("Papyrus", 1, 12)); // NOI18N
  175.         exitButton.setForeground(new java.awt.Color(255, 255, 0));
  176.         exitButton.setText("EXIT");
  177.         exitButton.addActionListener(new java.awt.event.ActionListener()
  178.         {
  179.             public void actionPerformed(java.awt.event.ActionEvent evt)
  180.             {
  181.                 exitButtonActionPerformed(evt);
  182.             }
  183.         });
  184.  
  185.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  186.         getContentPane().setLayout(layout);
  187.         layout.setHorizontalGroup(
  188.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  189.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  190.                       .addContainerGap()
  191.                       .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  192.                                 .addComponent(exitButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  193.                                 .addComponent(updateRadioButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  194.                                 .addComponent(menuLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  195.                                 .addComponent(displayRadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
  196.                                 .addComponent(insertRadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  197.                                 .addComponent(deleteRadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  198.                                 .addComponent(searchRadioButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  199.                       .addContainerGap())
  200.         );
  201.         layout.setVerticalGroup(
  202.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  203.             .addGroup(layout.createSequentialGroup()
  204.                       .addComponent(menuLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
  205.                       .addGap(18, 18, 18)
  206.                       .addComponent(displayRadioButton)
  207.                       .addGap(18, 18, 18)
  208.                       .addComponent(insertRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
  209.                       .addGap(18, 18, 18)
  210.                       .addComponent(deleteRadioButton)
  211.                       .addGap(18, 18, 18)
  212.                       .addComponent(updateRadioButton)
  213.                       .addGap(18, 18, 18)
  214.                       .addComponent(searchRadioButton)
  215.                       .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
  216.                       .addComponent(exitButton)
  217.                       .addGap(13, 13, 13))
  218.         );
  219.  
  220.         pack();
  221.         setLocationRelativeTo(null);
  222.     }// </editor-fold>
  223.  
  224.     private void exitButtonActionPerformed(java.awt.event.ActionEvent evt)
  225.     {
  226.         // TODO add your handling code here:
  227.         System.exit(0);
  228.     }
  229.  
  230.     private void displayRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
  231.     {
  232.         // TODO add your handling code here:
  233.         makeAllRadioButtonsUnset();
  234.         this.setVisible(false);
  235.         MemoryIndex memoryIndex = new MemoryIndex();
  236.         memoryIndex.setVisible(true);
  237.     }
  238.  
  239.     private void insertRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
  240.     {
  241.         // TODO add your handling code here:
  242.         makeAllRadioButtonsUnset();
  243.         this.setVisible(false);
  244.         MemoryInsert memoryInsert = new MemoryInsert();
  245.         memoryInsert.setVisible(true);
  246.     }
  247.  
  248.     private void deleteRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
  249.     {
  250.         // TODO add your handling code here:
  251.         makeAllRadioButtonsUnset();
  252.         this.setVisible(false);
  253.         MemoryIndex memoryIndex = new MemoryIndex();
  254.         memoryIndex.setVisible(true);
  255.     }
  256.  
  257.     private void updateRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
  258.     {
  259.         // TODO add your handling code here:
  260.         makeAllRadioButtonsUnset();
  261.         this.setVisible(false);
  262.         MemoryIndex memoryIndex = new MemoryIndex();
  263.         memoryIndex.setVisible(true);
  264.     }
  265.  
  266.     private void searchRadioButtonActionPerformed(java.awt.event.ActionEvent evt)
  267.     {
  268.         // TODO add your handling code here:
  269.         makeAllRadioButtonsUnset();
  270.         this.setVisible(false);
  271.         MemorySearch memorySearch = new MemorySearch();
  272.         memorySearch.setVisible(true);
  273.     }
  274.  
  275.     /**
  276.      * @param args the command line arguments
  277.      */
  278.     public static void main(String args[])
  279.     {
  280.         /* Set the Nimbus look and feel */
  281.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  282.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  283.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  284.          */
  285.         try
  286.         {
  287.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
  288.             {
  289.                 if ("Nimbus".equals(info.getName()))
  290.                 {
  291.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  292.                     break;
  293.                 }
  294.             }
  295.         }
  296.         catch (ClassNotFoundException ex)
  297.         {
  298.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  299.         }
  300.         catch (InstantiationException ex)
  301.         {
  302.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  303.         }
  304.         catch (IllegalAccessException ex)
  305.         {
  306.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  307.         }
  308.         catch (javax.swing.UnsupportedLookAndFeelException ex)
  309.         {
  310.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  311.         }
  312.         //</editor-fold>
  313.  
  314.         /* Create and display the form */
  315.         java.awt.EventQueue.invokeLater(new Runnable()
  316.         {
  317.             public void run()
  318.             {
  319.                 new Menu().setVisible(true);
  320.             }
  321.         });
  322.     }
  323.  
  324.     // Variables declaration - do not modify
  325.     private javax.swing.JRadioButton deleteRadioButton;
  326.     private javax.swing.JRadioButton displayRadioButton;
  327.     private javax.swing.JButton exitButton;
  328.     private javax.swing.JRadioButton insertRadioButton;
  329.     private javax.swing.JLabel menuLabel;
  330.     private javax.swing.JRadioButton searchRadioButton;
  331.     private javax.swing.JRadioButton updateRadioButton;
  332.     // End of variables declaration
  333. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement