Advertisement
Guest User

Javagradediscriptions

a guest
Jan 21st, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 63.15 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package grades;
  6.  
  7. import java.awt.Component;
  8. import java.awt.event.ContainerEvent;
  9. import static java.awt.image.ImageObserver.WIDTH;
  10. import javax.swing.ButtonModel;
  11. import javax.swing.ComboBoxModel;
  12. import javax.swing.event.ChangeEvent;
  13.  
  14. /**
  15.  *
  16.  * @author Nicholas
  17.  */
  18. public class gradesui extends javax.swing.JFrame {
  19.     boolean addingTab=false, addingProfile=false;
  20.     int numProfiles, index;
  21.     double gradePointScaleSelectedValue=0;
  22.     String gradePointScaleSelectedName, termTypeSelectedName, termTypeSelectedValue;
  23.     Profile blankProfile=new Profile("test","semester",4);
  24.     Profile currentProfile;        
  25.     Profile profiles[]=new Profile[0];
  26.  
  27.     /**
  28.      * Creates new form gradesui
  29.      */
  30.     public gradesui() {
  31.         currentProfile = blankProfile;
  32.         initComponents();
  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.         bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
  44.  
  45.         addProfile = new javax.swing.JDialog();
  46.         profileNameInput = new javax.swing.JFormattedTextField();
  47.         addProfileConfirm = new javax.swing.JButton();
  48.         jLabel2 = new javax.swing.JLabel();
  49.         jPanel3 = new javax.swing.JPanel();
  50.         jLabel3 = new javax.swing.JLabel();
  51.         termTypeSemester = new javax.swing.JRadioButton();
  52.         termTypeTrimester = new javax.swing.JRadioButton();
  53.         termTypeQuarter = new javax.swing.JRadioButton();
  54.         jPanel5 = new javax.swing.JPanel();
  55.         jLabel4 = new javax.swing.JLabel();
  56.         pointScale12 = new javax.swing.JRadioButton();
  57.         pointScale10 = new javax.swing.JRadioButton();
  58.         pointScale4 = new javax.swing.JRadioButton();
  59.         addProfileCancel = new javax.swing.JButton();
  60.         addTerm = new javax.swing.JDialog();
  61.         jLabel5 = new javax.swing.JLabel();
  62.         jSlider1 = new javax.swing.JSlider();
  63.         jFormattedTextField2 = new javax.swing.JFormattedTextField();
  64.         deleteProfile = new javax.swing.JDialog();
  65.         deleteProfile1 = new javax.swing.JOptionPane();
  66.         newTabFormat = new javax.swing.JPanel();
  67.         courseTabPane = new javax.swing.JTabbedPane();
  68.         jButton6 = new javax.swing.JButton();
  69.         addProfileTrimester = new javax.swing.JPanel();
  70.         jLabel13 = new javax.swing.JLabel();
  71.         trimester1 = new javax.swing.JRadioButton();
  72.         trimester2 = new javax.swing.JRadioButton();
  73.         trimester3 = new javax.swing.JRadioButton();
  74.         trimesterOther = new javax.swing.JRadioButton();
  75.         addProfileSemester = new javax.swing.JPanel();
  76.         jLabel12 = new javax.swing.JLabel();
  77.         semesterFall = new javax.swing.JRadioButton();
  78.         semesterSpring = new javax.swing.JRadioButton();
  79.         semesterOther = new javax.swing.JRadioButton();
  80.         addProfileQuarter = new javax.swing.JPanel();
  81.         jLabel14 = new javax.swing.JLabel();
  82.         quarter1 = new javax.swing.JRadioButton();
  83.         quarter2 = new javax.swing.JRadioButton();
  84.         quarterOther = new javax.swing.JRadioButton();
  85.         quarter3 = new javax.swing.JRadioButton();
  86.         quarter4 = new javax.swing.JRadioButton();
  87.         termType = new javax.swing.ButtonGroup();
  88.         addProfileGradePointScale = new javax.swing.ButtonGroup();
  89.         addProfileTermType = new javax.swing.ButtonGroup();
  90.         jLabel1 = new javax.swing.JLabel();
  91.         jPanel1 = new javax.swing.JPanel();
  92.         profileComboBox = new javax.swing.JComboBox();
  93.         jButton1 = new javax.swing.JButton();
  94.         jPanel4 = new javax.swing.JPanel();
  95.         profileDetailsTermTypeLabel = new javax.swing.JLabel();
  96.         profileDetailsTermType = new javax.swing.JLabel();
  97.         profileDetailsGradePointScaleLabel = new javax.swing.JLabel();
  98.         profileDetailsGradePointScale = new javax.swing.JLabel();
  99.         profileDetailsNumCoursesLabel = new javax.swing.JLabel();
  100.         profileDetailsNumCourses = new javax.swing.JLabel();
  101.         jPanel6 = new javax.swing.JPanel();
  102.         profileDetailGPALabel = new javax.swing.JLabel();
  103.         profileDetailsGPA = new javax.swing.JLabel();
  104.         profileDetailsCreditsTakenLabel = new javax.swing.JLabel();
  105.         profileDetailsCreditsTaken = new javax.swing.JLabel();
  106.         profileDetailsGradePointsLabel = new javax.swing.JLabel();
  107.         profileDetailsGradePoints = new javax.swing.JLabel();
  108.         jButton7 = new javax.swing.JButton();
  109.         jButton9 = new javax.swing.JButton();
  110.         jButton8 = new javax.swing.JButton();
  111.         filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767));
  112.         termTabPane = new javax.swing.JTabbedPane();
  113.         jButton5 = new javax.swing.JButton();
  114.         menuBar = new javax.swing.JMenuBar();
  115.         fileMenu = new javax.swing.JMenu();
  116.         exitMenuItem = new javax.swing.JMenuItem();
  117.         helpMenu = new javax.swing.JMenu();
  118.         aboutMenuItem = new javax.swing.JMenuItem();
  119.  
  120.         addProfile.setTitle("Create New Profile");
  121.         addProfile.setAlwaysOnTop(true);
  122.         addProfile.setBounds(new java.awt.Rectangle(0, 0, 480, 230));
  123.         addProfile.setLocationRelativeTo(null);
  124.  
  125.         profileNameInput.setToolTipText("");
  126.         profileNameInput.setName("profileNameInput"); // NOI18N
  127.  
  128.         addProfileConfirm.setText("Create Profile");
  129.         addProfileConfirm.addActionListener(new java.awt.event.ActionListener() {
  130.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  131.                 addProfileConfirmActionPerformed(evt);
  132.             }
  133.         });
  134.  
  135.         jLabel2.setText("Profile Name: ");
  136.  
  137.         jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
  138.  
  139.         jLabel3.setText("Academic Term Type");
  140.  
  141.         addProfileTermType.add(termTypeSemester);
  142.         termTypeSemester.setSelected(true);
  143.         termTypeSemester.setText("Semester");
  144.  
  145.         addProfileTermType.add(termTypeTrimester);
  146.         termTypeTrimester.setText("Trimester");
  147.  
  148.         addProfileTermType.add(termTypeQuarter);
  149.         termTypeQuarter.setText("Quarter");
  150.  
  151.         javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
  152.         jPanel3.setLayout(jPanel3Layout);
  153.         jPanel3Layout.setHorizontalGroup(
  154.             jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  155.             .addGroup(jPanel3Layout.createSequentialGroup()
  156.                 .addContainerGap()
  157.                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  158.                     .addComponent(jLabel3)
  159.                     .addGroup(jPanel3Layout.createSequentialGroup()
  160.                         .addGap(10, 10, 10)
  161.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  162.                             .addComponent(termTypeTrimester)
  163.                             .addComponent(termTypeSemester)
  164.                             .addComponent(termTypeQuarter))))
  165.                 .addContainerGap(84, Short.MAX_VALUE))
  166.         );
  167.         jPanel3Layout.setVerticalGroup(
  168.             jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  169.             .addGroup(jPanel3Layout.createSequentialGroup()
  170.                 .addContainerGap()
  171.                 .addComponent(jLabel3)
  172.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  173.                 .addComponent(termTypeSemester)
  174.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  175.                 .addComponent(termTypeTrimester)
  176.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  177.                 .addComponent(termTypeQuarter)
  178.                 .addContainerGap(15, Short.MAX_VALUE))
  179.         );
  180.  
  181.         jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
  182.  
  183.         jLabel4.setText("Grade Point Scale");
  184.  
  185.         addProfileGradePointScale.add(pointScale12);
  186.         pointScale12.setText("12 Point Scale");
  187.  
  188.         addProfileGradePointScale.add(pointScale10);
  189.         pointScale10.setText("10 Point Scale");
  190.  
  191.         addProfileGradePointScale.add(pointScale4);
  192.         pointScale4.setSelected(true);
  193.         pointScale4.setText("4 Point Scale (Most Common)");
  194.  
  195.         javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
  196.         jPanel5.setLayout(jPanel5Layout);
  197.         jPanel5Layout.setHorizontalGroup(
  198.             jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  199.             .addGroup(jPanel5Layout.createSequentialGroup()
  200.                 .addContainerGap()
  201.                 .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  202.                     .addComponent(jLabel4)
  203.                     .addGroup(jPanel5Layout.createSequentialGroup()
  204.                         .addGap(10, 10, 10)
  205.                         .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  206.                             .addComponent(pointScale10)
  207.                             .addComponent(pointScale4)
  208.                             .addComponent(pointScale12))))
  209.                 .addContainerGap(27, Short.MAX_VALUE))
  210.         );
  211.         jPanel5Layout.setVerticalGroup(
  212.             jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  213.             .addGroup(jPanel5Layout.createSequentialGroup()
  214.                 .addContainerGap()
  215.                 .addComponent(jLabel4)
  216.                 .addGap(7, 7, 7)
  217.                 .addComponent(pointScale4)
  218.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  219.                 .addComponent(pointScale10)
  220.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  221.                 .addComponent(pointScale12)
  222.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  223.         );
  224.  
  225.         addProfileCancel.setText("Cancel");
  226.         addProfileCancel.addActionListener(new java.awt.event.ActionListener() {
  227.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  228.                 addProfileCancelActionPerformed(evt);
  229.             }
  230.         });
  231.  
  232.         javax.swing.GroupLayout addProfileLayout = new javax.swing.GroupLayout(addProfile.getContentPane());
  233.         addProfile.getContentPane().setLayout(addProfileLayout);
  234.         addProfileLayout.setHorizontalGroup(
  235.             addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  236.             .addGroup(addProfileLayout.createSequentialGroup()
  237.                 .addContainerGap()
  238.                 .addGroup(addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  239.                     .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  240.                     .addGroup(addProfileLayout.createSequentialGroup()
  241.                         .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
  242.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  243.                         .addComponent(profileNameInput, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
  244.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  245.                 .addGroup(addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  246.                     .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  247.                     .addGroup(addProfileLayout.createSequentialGroup()
  248.                         .addComponent(addProfileCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  249.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  250.                         .addComponent(addProfileConfirm)))
  251.                 .addContainerGap())
  252.         );
  253.         addProfileLayout.setVerticalGroup(
  254.             addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  255.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addProfileLayout.createSequentialGroup()
  256.                 .addContainerGap()
  257.                 .addGroup(addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  258.                     .addGroup(addProfileLayout.createSequentialGroup()
  259.                         .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  260.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  261.                         .addGroup(addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  262.                             .addComponent(addProfileConfirm)
  263.                             .addComponent(addProfileCancel))
  264.                         .addGap(18, 18, 18))
  265.                     .addGroup(addProfileLayout.createSequentialGroup()
  266.                         .addGroup(addProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  267.                             .addComponent(profileNameInput)
  268.                             .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  269.                         .addGap(18, 18, 18)
  270.                         .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  271.                         .addContainerGap())))
  272.         );
  273.  
  274.         addTerm.setTitle("Add a Term...");
  275.         addTerm.setAlwaysOnTop(true);
  276.         addTerm.setBounds(new java.awt.Rectangle(410, 280, 410, 280));
  277.         addTerm.setType(java.awt.Window.Type.POPUP);
  278.         switch(currentProfile.getTermType()){
  279.             case "semester":      
  280.             addTerm.add(addProfileSemester);
  281.             break;
  282.             case "trimester":
  283.             addTerm.add(addProfileTrimester);
  284.             break;
  285.             case "quarter":
  286.             addTerm.add(addProfileQuarter);
  287.             break;
  288.             default:
  289.             break;
  290.         }
  291.         addTerm.setLocationRelativeTo(null);
  292.         addTerm.addWindowListener(new java.awt.event.WindowAdapter() {
  293.             public void windowActivated(java.awt.event.WindowEvent evt) {
  294.                 addTermWindowActivated(evt);
  295.             }
  296.             public void windowOpened(java.awt.event.WindowEvent evt) {
  297.                 addTermWindowOpened(evt);
  298.             }
  299.         });
  300.         addTerm.addFocusListener(new java.awt.event.FocusAdapter() {
  301.             public void focusGained(java.awt.event.FocusEvent evt) {
  302.                 addTermFocusGained(evt);
  303.             }
  304.         });
  305.  
  306.         jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  307.         jLabel5.setText("Term Year: ");
  308.  
  309.         jSlider1.setMajorTickSpacing(5);
  310.         jSlider1.setMaximum(2015);
  311.         jSlider1.setMinimum(2000);
  312.         jSlider1.setMinorTickSpacing(1);
  313.         jSlider1.setPaintLabels(true);
  314.         jSlider1.setPaintTicks(true);
  315.         jSlider1.setSnapToTicks(true);
  316.         jSlider1.setToolTipText("");
  317.         jSlider1.setValue(2013);
  318.  
  319.         jFormattedTextField2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("####"))));
  320.         jFormattedTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
  321.         jFormattedTextField2.setMargin(new java.awt.Insets(1, 1, 1, 1));
  322.  
  323.         org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jSlider1, org.jdesktop.beansbinding.ELProperty.create("${value}"), jFormattedTextField2, org.jdesktop.beansbinding.BeanProperty.create("value"));
  324.         bindingGroup.addBinding(binding);
  325.  
  326.         javax.swing.GroupLayout addTermLayout = new javax.swing.GroupLayout(addTerm.getContentPane());
  327.         addTerm.getContentPane().setLayout(addTermLayout);
  328.         addTermLayout.setHorizontalGroup(
  329.             addTermLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  330.             .addGroup(addTermLayout.createSequentialGroup()
  331.                 .addContainerGap()
  332.                 .addComponent(jLabel5)
  333.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  334.                 .addComponent(jFormattedTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
  335.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  336.                 .addComponent(jSlider1, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
  337.                 .addContainerGap())
  338.         );
  339.         addTermLayout.setVerticalGroup(
  340.             addTermLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  341.             .addGroup(addTermLayout.createSequentialGroup()
  342.                 .addContainerGap()
  343.                 .addGroup(addTermLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  344.                     .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  345.                     .addGroup(addTermLayout.createSequentialGroup()
  346.                         .addGap(9, 9, 9)
  347.                         .addGroup(addTermLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  348.                             .addComponent(jFormattedTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
  349.                             .addComponent(jLabel5))))
  350.                 .addContainerGap(152, Short.MAX_VALUE))
  351.         );
  352.  
  353.         deleteProfile.setAlwaysOnTop(true);
  354.         deleteProfile.setBounds(new java.awt.Rectangle(0, 0, 500, 200));
  355.         deleteProfile.setIconImage(null);
  356.  
  357.         deleteProfile1.setMessage("Are you sure you want to Delete Profile" + currentProfile.getName());
  358.         deleteProfile1.setMessageType(2);
  359.         deleteProfile1.setOptionType(0);
  360.         deleteProfile1.setToolTipText("");
  361.  
  362.         javax.swing.GroupLayout deleteProfileLayout = new javax.swing.GroupLayout(deleteProfile.getContentPane());
  363.         deleteProfile.getContentPane().setLayout(deleteProfileLayout);
  364.         deleteProfileLayout.setHorizontalGroup(
  365.             deleteProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  366.             .addGap(0, 500, Short.MAX_VALUE)
  367.             .addGroup(deleteProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  368.                 .addGroup(deleteProfileLayout.createSequentialGroup()
  369.                     .addGap(0, 119, Short.MAX_VALUE)
  370.                     .addComponent(deleteProfile1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  371.                     .addGap(0, 119, Short.MAX_VALUE)))
  372.         );
  373.         deleteProfileLayout.setVerticalGroup(
  374.             deleteProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  375.             .addGap(0, 200, Short.MAX_VALUE)
  376.             .addGroup(deleteProfileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  377.                 .addGroup(deleteProfileLayout.createSequentialGroup()
  378.                     .addGap(0, 55, Short.MAX_VALUE)
  379.                     .addComponent(deleteProfile1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  380.                     .addGap(0, 55, Short.MAX_VALUE)))
  381.         );
  382.  
  383.         newTabFormat.setName("newC"); // NOI18N
  384.  
  385.         javax.swing.GroupLayout newTabFormatLayout = new javax.swing.GroupLayout(newTabFormat);
  386.         newTabFormat.setLayout(newTabFormatLayout);
  387.         newTabFormatLayout.setHorizontalGroup(
  388.             newTabFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  389.             .addGap(0, 676, Short.MAX_VALUE)
  390.         );
  391.         newTabFormatLayout.setVerticalGroup(
  392.             newTabFormatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  393.             .addGap(0, 448, Short.MAX_VALUE)
  394.         );
  395.  
  396.         newTabFormat.getAccessibleContext().setAccessibleName("newTabFormat");
  397.  
  398.         courseTabPane.setToolTipText("");
  399.         courseTabPane.setName(""); // NOI18N
  400.         courseTabPane.setPreferredSize(new java.awt.Dimension(681, 454));
  401.         courseTabPane.addChangeListener(new javax.swing.event.ChangeListener() {
  402.             public void stateChanged(javax.swing.event.ChangeEvent evt) {
  403.                 courseTabPaneStateChanged(evt);
  404.             }
  405.         });
  406.         courseTabPane.addComponentListener(new java.awt.event.ComponentAdapter() {
  407.             public void componentShown(java.awt.event.ComponentEvent evt) {
  408.                 courseTabPaneComponentShown(evt);
  409.             }
  410.         });
  411.         courseTabPane.addContainerListener(new java.awt.event.ContainerAdapter() {
  412.             public void componentAdded(java.awt.event.ContainerEvent evt) {
  413.                 courseTabPaneComponentAdded(evt);
  414.             }
  415.         });
  416.         courseTabPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
  417.             public void propertyChange(java.beans.PropertyChangeEvent evt) {
  418.                 courseTabPanePropertyChange(evt);
  419.             }
  420.         });
  421.  
  422.         jButton6.setFont(new java.awt.Font("Lucida Calligraphy", 1, 36)); // NOI18N
  423.         jButton6.setText("Click Here to Add a Course");
  424.         courseTabPane.addTab("+", jButton6);
  425.  
  426.         courseTabPane.getAccessibleContext().setAccessibleName("courseTabPane");
  427.  
  428.         addProfileTrimester.setPreferredSize(new java.awt.Dimension(296, 70));
  429.  
  430.         jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  431.         jLabel13.setText("Trimester:");
  432.  
  433.         termType.add(trimester1);
  434.         trimester1.setText("1");
  435.         trimester1.addActionListener(new java.awt.event.ActionListener() {
  436.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  437.                 trimester1ActionPerformed(evt);
  438.             }
  439.         });
  440.  
  441.         termType.add(trimester2);
  442.         trimester2.setText("2");
  443.  
  444.         termType.add(trimester3);
  445.         trimester3.setText("3");
  446.  
  447.         termType.add(trimesterOther);
  448.         trimesterOther.setText("Other");
  449.  
  450.         javax.swing.GroupLayout addProfileTrimesterLayout = new javax.swing.GroupLayout(addProfileTrimester);
  451.         addProfileTrimester.setLayout(addProfileTrimesterLayout);
  452.         addProfileTrimesterLayout.setHorizontalGroup(
  453.             addProfileTrimesterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  454.             .addGroup(addProfileTrimesterLayout.createSequentialGroup()
  455.                 .addContainerGap()
  456.                 .addComponent(jLabel13)
  457.                 .addGap(18, 18, 18)
  458.                 .addComponent(trimester1)
  459.                 .addGap(18, 18, 18)
  460.                 .addComponent(trimester2)
  461.                 .addGap(18, 18, 18)
  462.                 .addComponent(trimester3)
  463.                 .addGap(18, 18, 18)
  464.                 .addComponent(trimesterOther)
  465.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  466.         );
  467.         addProfileTrimesterLayout.setVerticalGroup(
  468.             addProfileTrimesterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  469.             .addGroup(addProfileTrimesterLayout.createSequentialGroup()
  470.                 .addGap(23, 23, 23)
  471.                 .addGroup(addProfileTrimesterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  472.                     .addComponent(jLabel13)
  473.                     .addComponent(trimester1)
  474.                     .addComponent(trimester2)
  475.                     .addComponent(trimester3)
  476.                     .addComponent(trimesterOther))
  477.                 .addContainerGap(24, Short.MAX_VALUE))
  478.         );
  479.  
  480.         addProfileSemester.setPreferredSize(new java.awt.Dimension(296, 44));
  481.  
  482.         jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  483.         jLabel12.setText("Semester:");
  484.  
  485.         termType.add(semesterFall);
  486.         semesterFall.setText("Fall");
  487.  
  488.         termType.add(semesterSpring);
  489.         semesterSpring.setText("Spring");
  490.  
  491.         termType.add(semesterOther);
  492.         semesterOther.setText("Other");
  493.  
  494.         javax.swing.GroupLayout addProfileSemesterLayout = new javax.swing.GroupLayout(addProfileSemester);
  495.         addProfileSemester.setLayout(addProfileSemesterLayout);
  496.         addProfileSemesterLayout.setHorizontalGroup(
  497.             addProfileSemesterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  498.             .addGroup(addProfileSemesterLayout.createSequentialGroup()
  499.                 .addContainerGap()
  500.                 .addComponent(jLabel12)
  501.                 .addGap(18, 18, 18)
  502.                 .addComponent(semesterFall)
  503.                 .addGap(18, 18, 18)
  504.                 .addComponent(semesterSpring)
  505.                 .addGap(18, 18, 18)
  506.                 .addComponent(semesterOther)
  507.                 .addContainerGap(21, Short.MAX_VALUE))
  508.         );
  509.         addProfileSemesterLayout.setVerticalGroup(
  510.             addProfileSemesterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  511.             .addGroup(addProfileSemesterLayout.createSequentialGroup()
  512.                 .addGap(22, 22, 22)
  513.                 .addGroup(addProfileSemesterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  514.                     .addComponent(jLabel12)
  515.                     .addComponent(semesterFall)
  516.                     .addComponent(semesterSpring)
  517.                     .addComponent(semesterOther))
  518.                 .addContainerGap(25, Short.MAX_VALUE))
  519.         );
  520.  
  521.         addProfileQuarter.setPreferredSize(new java.awt.Dimension(296, 70));
  522.  
  523.         jLabel14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  524.         jLabel14.setText("Quarter:");
  525.  
  526.         termType.add(quarter1);
  527.         quarter1.setText("One");
  528.  
  529.         termType.add(quarter2);
  530.         quarter2.setText("Two");
  531.  
  532.         termType.add(quarterOther);
  533.         quarterOther.setText("Other");
  534.  
  535.         termType.add(quarter3);
  536.         quarter3.setText("Three");
  537.  
  538.         termType.add(quarter4);
  539.         quarter4.setText("Four");
  540.  
  541.         javax.swing.GroupLayout addProfileQuarterLayout = new javax.swing.GroupLayout(addProfileQuarter);
  542.         addProfileQuarter.setLayout(addProfileQuarterLayout);
  543.         addProfileQuarterLayout.setHorizontalGroup(
  544.             addProfileQuarterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  545.             .addGroup(addProfileQuarterLayout.createSequentialGroup()
  546.                 .addContainerGap()
  547.                 .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
  548.                 .addGap(18, 18, 18)
  549.                 .addGroup(addProfileQuarterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  550.                     .addGroup(addProfileQuarterLayout.createSequentialGroup()
  551.                         .addComponent(quarter4)
  552.                         .addGap(18, 18, 18)
  553.                         .addComponent(quarterOther))
  554.                     .addGroup(addProfileQuarterLayout.createSequentialGroup()
  555.                         .addComponent(quarter1)
  556.                         .addGap(18, 18, 18)
  557.                         .addComponent(quarter2)
  558.                         .addGap(18, 18, 18)
  559.                         .addComponent(quarter3)))
  560.                 .addContainerGap(36, Short.MAX_VALUE))
  561.         );
  562.         addProfileQuarterLayout.setVerticalGroup(
  563.             addProfileQuarterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  564.             .addGroup(addProfileQuarterLayout.createSequentialGroup()
  565.                 .addContainerGap()
  566.                 .addGroup(addProfileQuarterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  567.                     .addComponent(jLabel14)
  568.                     .addComponent(quarter1)
  569.                     .addComponent(quarter2)
  570.                     .addComponent(quarter3))
  571.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  572.                 .addGroup(addProfileQuarterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  573.                     .addComponent(quarter4)
  574.                     .addComponent(quarterOther))
  575.                 .addContainerGap(11, Short.MAX_VALUE))
  576.         );
  577.  
  578.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  579.         setBounds(new java.awt.Rectangle(0, 0, 683, 736));
  580.         addWindowStateListener(new java.awt.event.WindowStateListener() {
  581.             public void windowStateChanged(java.awt.event.WindowEvent evt) {
  582.                 formWindowStateChanged(evt);
  583.             }
  584.         });
  585.  
  586.         jLabel1.setText("created by Nick Bolles");
  587.         jLabel1.setToolTipText("");
  588.         jLabel1.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
  589.         jLabel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
  590.         jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  591.         jLabel1.setName(""); // NOI18N
  592.         jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  593.  
  594.         jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Profile", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 0, 18))); // NOI18N
  595.  
  596.         profileComboBox.setMaximumRowCount(10);
  597.         profileComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Create a Profile>>" }));
  598.         profileComboBox.setToolTipText("Click The '+' To Add A Profile");
  599.         profileComboBox.addItemListener(new java.awt.event.ItemListener() {
  600.             public void itemStateChanged(java.awt.event.ItemEvent evt) {
  601.                 profileComboBoxItemStateChanged(evt);
  602.             }
  603.         });
  604.         profileComboBox.addActionListener(new java.awt.event.ActionListener() {
  605.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  606.                 profileComboBoxActionPerformed(evt);
  607.             }
  608.         });
  609.  
  610.         jButton1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  611.         jButton1.setText("+");
  612.         jButton1.setAlignmentY(0.0F);
  613.         jButton1.setBorder(null);
  614.         jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  615.         jButton1.setMaximumSize(new java.awt.Dimension(24, 27));
  616.         jButton1.setMinimumSize(new java.awt.Dimension(24, 27));
  617.         jButton1.setPreferredSize(new java.awt.Dimension(24, 27));
  618.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  619.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  620.                 jButton1ActionPerformed(evt);
  621.             }
  622.         });
  623.  
  624.         jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Profile Information"));
  625.  
  626.         profileDetailsTermTypeLabel.setText("Academic Term Type:");
  627.  
  628.         profileDetailsTermType.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  629.  
  630.         profileDetailsGradePointScaleLabel.setText("Grade Point Scale: ");
  631.  
  632.         profileDetailsGradePointScale.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  633.  
  634.         profileDetailsNumCoursesLabel.setText("Number of Courses: ");
  635.  
  636.         profileDetailsNumCourses.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  637.  
  638.         javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
  639.         jPanel4.setLayout(jPanel4Layout);
  640.         jPanel4Layout.setHorizontalGroup(
  641.             jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  642.             .addGroup(jPanel4Layout.createSequentialGroup()
  643.                 .addContainerGap(12, Short.MAX_VALUE)
  644.                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  645.                     .addComponent(profileDetailsTermTypeLabel)
  646.                     .addComponent(profileDetailsGradePointScaleLabel)
  647.                     .addComponent(profileDetailsNumCoursesLabel))
  648.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  649.                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  650.                     .addComponent(profileDetailsGradePointScale, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
  651.                     .addComponent(profileDetailsNumCourses, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  652.                     .addComponent(profileDetailsTermType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  653.                 .addGap(10, 10, 10))
  654.         );
  655.         jPanel4Layout.setVerticalGroup(
  656.             jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  657.             .addGroup(jPanel4Layout.createSequentialGroup()
  658.                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  659.                     .addComponent(profileDetailsTermTypeLabel)
  660.                     .addComponent(profileDetailsTermType, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
  661.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  662.                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  663.                     .addComponent(profileDetailsGradePointScaleLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  664.                     .addComponent(profileDetailsGradePointScale, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  665.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  666.                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  667.                     .addComponent(profileDetailsNumCoursesLabel)
  668.                     .addComponent(profileDetailsNumCourses, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
  669.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  670.         );
  671.  
  672.         jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Grade Information"));
  673.  
  674.         profileDetailGPALabel.setText("Grade Point Average");
  675.  
  676.         profileDetailsGPA.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  677.  
  678.         profileDetailsCreditsTakenLabel.setText("Credits Taken");
  679.  
  680.         profileDetailsCreditsTaken.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  681.  
  682.         profileDetailsGradePointsLabel.setText("Grade Points");
  683.  
  684.         profileDetailsGradePoints.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  685.  
  686.         javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
  687.         jPanel6.setLayout(jPanel6Layout);
  688.         jPanel6Layout.setHorizontalGroup(
  689.             jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  690.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
  691.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  692.                 .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  693.                     .addComponent(profileDetailGPALabel)
  694.                     .addComponent(profileDetailsCreditsTakenLabel)
  695.                     .addComponent(profileDetailsGradePointsLabel))
  696.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  697.                 .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  698.                     .addComponent(profileDetailsGPA, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  699.                     .addComponent(profileDetailsCreditsTaken, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  700.                     .addComponent(profileDetailsGradePoints, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
  701.                 .addContainerGap())
  702.         );
  703.         jPanel6Layout.setVerticalGroup(
  704.             jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  705.             .addGroup(jPanel6Layout.createSequentialGroup()
  706.                 .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  707.                     .addComponent(profileDetailGPALabel)
  708.                     .addComponent(profileDetailsGPA, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
  709.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  710.                 .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  711.                     .addComponent(profileDetailsCreditsTakenLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  712.                     .addComponent(profileDetailsCreditsTaken, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  713.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  714.                 .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  715.                     .addComponent(profileDetailsGradePointsLabel)
  716.                     .addComponent(profileDetailsGradePoints, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
  717.                 .addContainerGap(32, Short.MAX_VALUE))
  718.         );
  719.  
  720.         jButton7.setText("Delete");
  721.         jButton7.addActionListener(new java.awt.event.ActionListener() {
  722.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  723.                 jButton7ActionPerformed(evt);
  724.             }
  725.         });
  726.  
  727.         jButton9.setText("Details");
  728.  
  729.         jButton8.setText("Edit");
  730.         jButton8.addActionListener(new java.awt.event.ActionListener() {
  731.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  732.                 jButton8ActionPerformed(evt);
  733.             }
  734.         });
  735.  
  736.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  737.         jPanel1.setLayout(jPanel1Layout);
  738.         jPanel1Layout.setHorizontalGroup(
  739.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  740.             .addGroup(jPanel1Layout.createSequentialGroup()
  741.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  742.                     .addGroup(jPanel1Layout.createSequentialGroup()
  743.                         .addGap(0, 4, Short.MAX_VALUE)
  744.                         .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  745.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  746.                         .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  747.                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
  748.                         .addContainerGap()
  749.                         .addComponent(profileComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
  750.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  751.                         .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  752.                         .addGap(26, 26, 26)
  753.                         .addComponent(jButton8)
  754.                         .addGap(18, 18, 18)
  755.                         .addComponent(jButton9)
  756.                         .addGap(18, 18, 18)
  757.                         .addComponent(jButton7)
  758.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  759.                         .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  760.                 .addGap(4, 4, 4))
  761.         );
  762.         jPanel1Layout.setVerticalGroup(
  763.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  764.             .addGroup(jPanel1Layout.createSequentialGroup()
  765.                 .addContainerGap()
  766.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  767.                     .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  768.                         .addComponent(profileComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  769.                         .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  770.                     .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  771.                         .addComponent(jButton7)
  772.                         .addComponent(jButton9)
  773.                         .addComponent(jButton8)))
  774.                 .addGap(10, 10, 10)
  775.                 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  776.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  777.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  778.                     .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  779.                     .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  780.                 .addGap(4, 4, 4))
  781.         );
  782.  
  783.         termTabPane.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
  784.         termTabPane.setToolTipText("");
  785.         termTabPane.setEnabled(false);
  786.         termTabPane.setName(""); // NOI18N
  787.         termTabPane.setNextFocusableComponent(courseTabPane);
  788.         termTabPane.setOpaque(true);
  789.         termTabPane.setPreferredSize(new java.awt.Dimension(681, 454));
  790.         termTabPane.addChangeListener(new javax.swing.event.ChangeListener() {
  791.             public void stateChanged(javax.swing.event.ChangeEvent evt) {
  792.                 termTabPaneStateChanged(evt);
  793.             }
  794.         });
  795.         termTabPane.addComponentListener(new java.awt.event.ComponentAdapter() {
  796.             public void componentShown(java.awt.event.ComponentEvent evt) {
  797.                 termTabPaneComponentShown(evt);
  798.             }
  799.         });
  800.         termTabPane.addContainerListener(new java.awt.event.ContainerAdapter() {
  801.             public void componentAdded(java.awt.event.ContainerEvent evt) {
  802.                 termTabPaneComponentAdded(evt);
  803.             }
  804.         });
  805.         termTabPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
  806.             public void propertyChange(java.beans.PropertyChangeEvent evt) {
  807.                 termTabPanePropertyChange(evt);
  808.             }
  809.         });
  810.  
  811.         jButton5.setFont(new java.awt.Font("Lucida Calligraphy", 1, 36)); // NOI18N
  812.         jButton5.setText("Click Here to Add a Course");
  813.         termTabPane.addTab("+", jButton5);
  814.         jButton5.getAccessibleContext().setAccessibleName("addCourseButton");
  815.  
  816.         fileMenu.setMnemonic('f');
  817.         fileMenu.setText("File");
  818.  
  819.         exitMenuItem.setMnemonic('x');
  820.         exitMenuItem.setText("Exit");
  821.         exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
  822.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  823.                 exitMenuItemActionPerformed(evt);
  824.             }
  825.         });
  826.         fileMenu.add(exitMenuItem);
  827.  
  828.         menuBar.add(fileMenu);
  829.  
  830.         helpMenu.setMnemonic('h');
  831.         helpMenu.setText("Help");
  832.  
  833.         aboutMenuItem.setMnemonic('a');
  834.         aboutMenuItem.setText("About");
  835.         helpMenu.add(aboutMenuItem);
  836.  
  837.         menuBar.add(helpMenu);
  838.  
  839.         setJMenuBar(menuBar);
  840.  
  841.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  842.         getContentPane().setLayout(layout);
  843.         layout.setHorizontalGroup(
  844.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  845.             .addGroup(layout.createSequentialGroup()
  846.                 .addContainerGap()
  847.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  848.                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  849.                         .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
  850.                         .addGap(0, 0, Short.MAX_VALUE)
  851.                         .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  852.                         .addGap(6, 6, 6))
  853.                     .addComponent(termTabPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
  854.                 .addContainerGap())
  855.         );
  856.         layout.setVerticalGroup(
  857.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  858.             .addGroup(layout.createSequentialGroup()
  859.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  860.                     .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  861.                     .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  862.                 .addGap(15, 15, 15)
  863.                 .addComponent(termTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 495, javax.swing.GroupLayout.PREFERRED_SIZE)
  864.                 .addContainerGap(75, Short.MAX_VALUE))
  865.         );
  866.  
  867.         termTabPane.getAccessibleContext().setAccessibleName("termTabPane");
  868.  
  869.         bindingGroup.bind();
  870.  
  871.         pack();
  872.         setLocationRelativeTo(null);
  873.     }// </editor-fold>                        
  874.  
  875.     private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                            
  876.         System.exit(0);
  877.     }                                            
  878.  
  879.     private void termTabPaneStateChanged(javax.swing.event.ChangeEvent evt) {                                        
  880.         if (addingTab!=false){
  881.             return;
  882.         }
  883.         System.out.println("state change tripped");
  884.         if (termTabPane.getTitleAt(termTabPane.getSelectedIndex()).equals("+")){
  885.             System.out.println("before changing tabs");
  886.             if (addingTab!=false){
  887.                 System.out.println("skipped add new tab: allready in progress");
  888.                 addNewTab("term",null,null,0);
  889.  
  890.             }
  891.             else{
  892.                 addingTab=true;
  893.                 addNewTab("term",null,null,0);
  894.             }
  895.         }
  896.         else{
  897.             System.out.println("failed adding tab");
  898.         }    }                                                        
  899.  
  900.     private void addTermWindowOpened(java.awt.event.WindowEvent evt) {                                    
  901.         setLocationRelativeTo(null);
  902.         // TODO add your handling code here:
  903.     }                                                                    
  904.  
  905.     private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  906.         deleteProfile.setLocationRelativeTo(null);
  907.         deleteProfile.setVisible(true);        
  908.         Object response=deleteProfile1.getValue();
  909.     }                                        
  910.  
  911.     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  912.         addProfile.setVisible(true);
  913.     }                                        
  914.  
  915.     private void addProfileConfirmActionPerformed(java.awt.event.ActionEvent evt) {                                                  
  916.         //remove filler "Create a Profile>>" item
  917.         addingProfile=true;
  918.         if (profileComboBox.getItemAt(0).equals("Create a Profile>>")){
  919.                     profileComboBox.removeItem("Create a Profile>>");
  920.         }
  921.         //find length of profiles array and set it to numProfiles for easier use
  922.         profiles=new Profile[profiles.length+1];
  923.         numProfiles = profiles.length;
  924.         //getting selected button and
  925.         if (pointScale4.isSelected()==true){
  926.                 gradePointScaleSelectedValue=4.0;            
  927.         }
  928.         else if(pointScale10.isSelected()==true){
  929.                 gradePointScaleSelectedValue=10;            
  930.         }
  931.         else if(pointScale12.isSelected()==true){
  932.                 gradePointScaleSelectedValue=12;            
  933.         }
  934.         else{System.out.println("error: grade scale if statement went to else");}
  935.        
  936.        
  937.         //setting TermType
  938.         if (termTypeSemester.isSelected()==true){
  939.                 termTypeSelectedValue="semester";            
  940.         }
  941.         else if(termTypeQuarter.isSelected()==true){
  942.                 termTypeSelectedValue="quarter";            
  943.         }
  944.         else if(termTypeTrimester.isSelected()==true){
  945.                 termTypeSelectedValue="trimester";            
  946.         }
  947.         else{System.out.println("error: termtype if statement went to else");}
  948.  
  949.        
  950.        
  951.         profiles[(numProfiles-1)]=new Profile(profileNameInput.getText(),termTypeSelectedValue,gradePointScaleSelectedValue);
  952.         //TROUBLESHOOTING
  953.         //System.out.println("termType="+termTypeSelectedValue+"  gradepointscale="+gradePointScaleSelectedValue);
  954.         //System.out.println(profiles[(numProfiles-1)].getName());
  955.        
  956.         //add created profile to combo box and set it as selected profile
  957.        
  958.         addingProfile=false;
  959.         profileComboBox.addItem(profiles[numProfiles-1].getName());
  960.         profileComboBox.setSelectedIndex((numProfiles-1));
  961.    
  962.        
  963.         //TROUBLESHOOTING
  964.         //System.out.println("profiles.termType="+profiles[numProfiles-1].getTermType()+"  profiles.gradepointscale="+profiles[numProfiles-1].getGpaScale());
  965.  
  966.         //hiding window and clearing values
  967.         addProfile.setVisible(false);
  968.        
  969.         profileNameInput.setText("");
  970.         addProfileTermType.clearSelection();
  971.         addProfileGradePointScale.clearSelection();
  972.         termTabPane.setEnabled(true);
  973.     }                                                
  974.  
  975.     private void addProfileCancelActionPerformed(java.awt.event.ActionEvent evt) {                                                
  976.         addProfile.setVisible(false);        // TODO add your handling code here:
  977.     }                                                
  978.  
  979.                                                
  980.  
  981.     private void profileComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {                                                
  982.        
  983.        
  984.         try{
  985.                 if(currentProfile==profiles[profileComboBox.getSelectedIndex()]){
  986.                 }
  987.                 else if(addingProfile!=false){
  988.                     //Troubleshooting
  989.                     System.out.println("skipped update combobox: adding profile in progress");
  990.                 }
  991.                 else {
  992.                     currentProfile=profiles[profileComboBox.getSelectedIndex()];
  993.                     System.out.println("selected index "+profileComboBox.getSelectedIndex());
  994.                     for(int i=0;i<profiles.length;i++){
  995.                         index=i;
  996.                         System.out.println("index is "+index);
  997.                         System.out.println("profiles length is "+profiles.length);
  998.                         System.out.println("name is: "+profiles[i].getName());
  999.                         System.out.println("termType is: "+profiles[i].getTermType());
  1000.                     }
  1001. //Printout for this is here:
  1002. //***I add a profile named "nick" with term type "semester"
  1003. //selected index 0
  1004. //***Combobox selected index
  1005. //index is 0
  1006. //***profiles array index
  1007. //profiles length is 1
  1008. //***length of profiles array
  1009. //name is: nick
  1010. //termType is: semester
  1011. //***correctly prints out profiles[0].getName() and getTermType()
  1012. //***Add another profile named "john" with term type "quarter" and set combobox selection to new profile
  1013. //selected index 1
  1014. //***"john" is selected in combobox, index is 1
  1015. //index is 0
  1016. //***printing out profiles[0]
  1017. /profiles length is 2
  1018. //***profiles array length is 2
  1019. //error: null pointer exception at 0
  1020. //***null pointer of profiles[0]
  1021.                     updateLabels();
  1022.                }
  1023.             }catch(ArrayIndexOutOfBoundsException e){
  1024.                 //Troubleshooting
  1025.            
  1026.             }catch(NullPointerException n){
  1027.                 System.out.println("error: null pointer exception at "+index);
  1028.                 //System.out.println("arrayOutOfbounds index was" + (profileComboBox.getSelectedIndex()+1));
  1029.             }    }                                                
  1030.   /**
  1031.      * @param args the command line arguments
  1032.      */
  1033.     private void addNewTab(String type,String title, Component compt, int index){
  1034.         if (addingTab!=false){
  1035.  
  1036.             //Finding number of tabs and adding tab at that index, replacing the + tab
  1037.             //this next line will push the + tab over, allowing us to keep the + tab
  1038.             switch(type){
  1039.                 //type 1 comes from course tab
  1040.                 case "course":
  1041.                    
  1042.                     int courseTabPaneNumTabs=(int) courseTabPane.getTabCount();
  1043.                     courseTabPane.insertTab("New Class", null, newTabFormat, null, (courseTabPaneNumTabs-1));
  1044.  
  1045.                     //Just added a tab above so dont need to compensate for index starting at 0
  1046.                     courseTabPane.setSelectedIndex(courseTabPaneNumTabs-1);
  1047.  
  1048.                 break;
  1049.                 //type2 comes from term tab
  1050.                 case "term":
  1051.                     int termTabPaneNumTabs=(int) termTabPane.getTabCount();
  1052.                     termTabPane.insertTab("New Term", null, courseTabPane, null, (termTabPaneNumTabs-1));
  1053.  
  1054.                     //Just added a tab above so dont need to compensate for index starting at 0
  1055.                     termTabPane.setSelectedIndex(termTabPaneNumTabs-1);
  1056.                     addTerm.setVisible(true);
  1057.                    
  1058.                 break;
  1059.                 case "custom":
  1060.                     //making use of this method to add tabs that are defined in a different area, such as bulk add
  1061.                 break;
  1062.                 default: System.out.println("error passing addTabType to addNewTab() method");
  1063.             }
  1064.             addingTab=false;
  1065.             //TODO add new class tab here prompting for info
  1066.                 //Show window asking for class name, credits, and total points(if known)
  1067.            
  1068.         }
  1069.     }
  1070.     private void updateLabels(){
  1071.                    
  1072.                     //convert all values to be used in details pane to a string
  1073.                     /*String gpaType=Double.toString(currentProfile.getGpaScale());
  1074.                     String gpa=Double.toString(currentProfile.getGPA());
  1075.                     String numCourses=Integer.toString(currentProfile.getNumCourses());
  1076.                     String credits=Integer.toString(currentProfile.getCredits());
  1077.                     String gradePoints=Integer.toString(currentProfile.getGradePoints());
  1078.                     //Troubleshooting
  1079.                     System.out.println("gpaType"+gpaType+" gpa"+gpa+" numCourses"+numCourses+" credits "+credits+" gradepoints"+gradePoints);
  1080.                     profileDetailsGradePointScale.setText(gpaType);
  1081.                     profileDetailsGPA.setText(gpa);
  1082.                     profileDetailsNumCourses.setText(numCourses);
  1083.                     profileDetailsCreditsTaken.setText(credits);
  1084.                     profileDetailsGradePoints.setText(gradePoints);
  1085.                     profileDetailsTermType.setText(currentProfile.getTermType());
  1086.     }
  1087.        
  1088.     public static void main(String args[]) {
  1089.         /* Set the Nimbus look and feel */
  1090.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  1091.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  1092.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  1093.          */
  1094.         try {
  1095.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  1096.                 if ("Nimbus".equals(info.getName())) {
  1097.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  1098.                     break;
  1099.                 }
  1100.             }
  1101.         } catch (ClassNotFoundException ex) {
  1102.             java.util.logging.Logger.getLogger(gradesui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1103.         } catch (InstantiationException ex) {
  1104.             java.util.logging.Logger.getLogger(gradesui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1105.         } catch (IllegalAccessException ex) {
  1106.             java.util.logging.Logger.getLogger(gradesui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1107.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  1108.             java.util.logging.Logger.getLogger(gradesui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1109.         }
  1110.         //</editor-fold>
  1111.  
  1112.         /* Create and display the form */
  1113.         java.awt.EventQueue.invokeLater(new Runnable() {
  1114.             @Override
  1115.             public void run() {
  1116.                 new gradesui().setVisible(true);
  1117.             }
  1118.         });
  1119.         //Profile profiles[]=new Profile[];
  1120.     }
  1121.     // Variables declaration - do not modify                    
  1122.     private javax.swing.JMenuItem aboutMenuItem;
  1123.     private javax.swing.JDialog addProfile;
  1124.     private javax.swing.JButton addProfileCancel;
  1125.     private javax.swing.JButton addProfileConfirm;
  1126.     private javax.swing.ButtonGroup addProfileGradePointScale;
  1127.     private javax.swing.JPanel addProfileQuarter;
  1128.     private javax.swing.JPanel addProfileSemester;
  1129.     private javax.swing.ButtonGroup addProfileTermType;
  1130.     private javax.swing.JPanel addProfileTrimester;
  1131.     private javax.swing.JDialog addTerm;
  1132.     private javax.swing.JTabbedPane courseTabPane;
  1133.     private javax.swing.JDialog deleteProfile;
  1134.     private javax.swing.JOptionPane deleteProfile1;
  1135.     private javax.swing.JMenuItem exitMenuItem;
  1136.     private javax.swing.JMenu fileMenu;
  1137.     private javax.swing.Box.Filler filler1;
  1138.     private javax.swing.JMenu helpMenu;
  1139.     private javax.swing.JButton jButton1;
  1140.     private javax.swing.JButton jButton5;
  1141.     private javax.swing.JButton jButton6;
  1142.     private javax.swing.JButton jButton7;
  1143.     private javax.swing.JButton jButton8;
  1144.     private javax.swing.JButton jButton9;
  1145.     private javax.swing.JFormattedTextField jFormattedTextField2;
  1146.     private javax.swing.JLabel jLabel1;
  1147.     private javax.swing.JLabel jLabel12;
  1148.     private javax.swing.JLabel jLabel13;
  1149.     private javax.swing.JLabel jLabel14;
  1150.     private javax.swing.JLabel jLabel2;
  1151.     private javax.swing.JLabel jLabel3;
  1152.     private javax.swing.JLabel jLabel4;
  1153.     private javax.swing.JLabel jLabel5;
  1154.     private javax.swing.JPanel jPanel1;
  1155.     private javax.swing.JPanel jPanel3;
  1156.     private javax.swing.JPanel jPanel4;
  1157.     private javax.swing.JPanel jPanel5;
  1158.     private javax.swing.JPanel jPanel6;
  1159.     private javax.swing.JSlider jSlider1;
  1160.     private javax.swing.JMenuBar menuBar;
  1161.     private javax.swing.JPanel newTabFormat;
  1162.     private javax.swing.JRadioButton pointScale10;
  1163.     private javax.swing.JRadioButton pointScale12;
  1164.     private javax.swing.JRadioButton pointScale4;
  1165.     private javax.swing.JComboBox profileComboBox;
  1166.     private javax.swing.JLabel profileDetailGPALabel;
  1167.     private javax.swing.JLabel profileDetailsCreditsTaken;
  1168.     private javax.swing.JLabel profileDetailsCreditsTakenLabel;
  1169.     private javax.swing.JLabel profileDetailsGPA;
  1170.     private javax.swing.JLabel profileDetailsGradePointScale;
  1171.     private javax.swing.JLabel profileDetailsGradePointScaleLabel;
  1172.     private javax.swing.JLabel profileDetailsGradePoints;
  1173.     private javax.swing.JLabel profileDetailsGradePointsLabel;
  1174.     private javax.swing.JLabel profileDetailsNumCourses;
  1175.     private javax.swing.JLabel profileDetailsNumCoursesLabel;
  1176.     private javax.swing.JLabel profileDetailsTermType;
  1177.     private javax.swing.JLabel profileDetailsTermTypeLabel;
  1178.     private javax.swing.JFormattedTextField profileNameInput;
  1179.     private javax.swing.JRadioButton quarter1;
  1180.     private javax.swing.JRadioButton quarter2;
  1181.     private javax.swing.JRadioButton quarter3;
  1182.     private javax.swing.JRadioButton quarter4;
  1183.     private javax.swing.JRadioButton quarterOther;
  1184.     private javax.swing.JRadioButton semesterFall;
  1185.     private javax.swing.JRadioButton semesterOther;
  1186.     private javax.swing.JRadioButton semesterSpring;
  1187.     private javax.swing.JTabbedPane termTabPane;
  1188.     private javax.swing.ButtonGroup termType;
  1189.     private javax.swing.JRadioButton termTypeQuarter;
  1190.     private javax.swing.JRadioButton termTypeSemester;
  1191.     private javax.swing.JRadioButton termTypeTrimester;
  1192.     private javax.swing.JRadioButton trimester1;
  1193.     private javax.swing.JRadioButton trimester2;
  1194.     private javax.swing.JRadioButton trimester3;
  1195.     private javax.swing.JRadioButton trimesterOther;
  1196.     private org.jdesktop.beansbinding.BindingGroup bindingGroup;
  1197.     // End of variables declaration                  
  1198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement