Please take time to read the code disclaimer.

<--Go back to Kent's Projects

<--Go back to project post

package employeesystem;

import backend.*;
import javax.swing.JFrame;
import silverlining.*;

/**
 * MyStuffClerkGUI.java
 * Created on Nov 12, 2011, 8:26:34 AM
 * @author Kent
 */
public class SalespersonGUI extends javax.swing.JFrame {

  private AccountGenerator ag;
  
  /** Creates new form MyStuffClerkGUI
   * @param ag 
   */
  public SalespersonGUI(AccountGenerator ag) {
    this.ag = ag;
    initComponents();
    this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    StaticClass.centerAndPack(this);
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // //GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        myStuffLogo = new javax.swing.JLabel();
        salespersonUtilityLabel = new javax.swing.JLabel();
        currentUserLabel = new javax.swing.JLabel();
        logoutButton = new javax.swing.JButton();
        newBusinessLabel = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        logout = new javax.swing.JMenuItem();
        membershipMenu = new javax.swing.JMenu();
        createNewMember = new javax.swing.JMenuItem();
        userAccounts = new javax.swing.JMenuItem();
        prepackageManagementMenu = new javax.swing.JMenu();
        createPrepackage = new javax.swing.JMenuItem();
        updatePrepackage = new javax.swing.JMenuItem();
        deletePrepackage = new javax.swing.JMenuItem();
        itemsMenu = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        reportsMenu = new javax.swing.JMenu();
        salespersonRankingItem = new javax.swing.JMenuItem();
        viewUnredeemedAwards = new javax.swing.JMenuItem();
        systemUtilitiesMenu = new javax.swing.JMenu();
        printersAndDevices = new javax.swing.JMenuItem();
        backupAndRecovery = new javax.swing.JMenuItem();
        userAccountsSubMenu = new javax.swing.JMenu();
        maintainAccounts = new javax.swing.JMenuItem();
        changeCurrentUserPassword = new javax.swing.JMenuItem();
        userPreferencesMenu = new javax.swing.JMenu();
        dialogStyle = new javax.swing.JMenuItem();
        colorAndFont = new javax.swing.JMenuItem();
        shortcuts = new javax.swing.JMenuItem();
        macroFacility = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        contentsAndIndex = new javax.swing.JMenuItem();
        searchForHelp = new javax.swing.JMenuItem();
        taskList = new javax.swing.JMenuItem();
        aboutTheMyStuffSystem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SLEEK - Salesperson Utility");
        setMinimumSize(new java.awt.Dimension(200, 100));
        getContentPane().setLayout(new java.awt.GridBagLayout());

        myStuffLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/SilverLiningLogo25%.jpg"))); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.insets = new java.awt.Insets(30, 30, 30, 30);
        getContentPane().add(myStuffLogo, gridBagConstraints);

        salespersonUtilityLabel.setFont(new java.awt.Font("Tahoma", 0, 36));
        salespersonUtilityLabel.setText("Employee Utility");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.insets = new java.awt.Insets(30, 30, 30, 30);
        getContentPane().add(salespersonUtilityLabel, gridBagConstraints);

        currentUserLabel.setFont(new java.awt.Font("Tahoma", 0, 18));
        currentUserLabel.setText("Current User: DEMO CURRENT USER");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
        getContentPane().add(currentUserLabel, gridBagConstraints);

        logoutButton.setText("Logout");
        logoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutButtonActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.LAST_LINE_END;
        gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
        getContentPane().add(logoutButton, gridBagConstraints);

        newBusinessLabel.setText("There is no business like new business");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
        getContentPane().add(newBusinessLabel, gridBagConstraints);

        fileMenu.setText("File");

        logout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        logout.setText("Logout");
        logout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutActionPerformed(evt);
            }
        });
        fileMenu.add(logout);

        menuBar.add(fileMenu);

        membershipMenu.setText("Accounts");

        createNewMember.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        createNewMember.setText("Account Management");
        createNewMember.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                createNewMemberActionPerformed(evt);
            }
        });
        membershipMenu.add(createNewMember);

        userAccounts.setText("User Accounts");
        membershipMenu.add(userAccounts);

        prepackageManagementMenu.setText("Prepackage Management");

        createPrepackage.setText("Create Prepackage");
        prepackageManagementMenu.add(createPrepackage);

        updatePrepackage.setText("Update Prepackage");
        prepackageManagementMenu.add(updatePrepackage);

        deletePrepackage.setText("Delete Prepackage");
        prepackageManagementMenu.add(deletePrepackage);

        membershipMenu.add(prepackageManagementMenu);

        menuBar.add(membershipMenu);

        itemsMenu.setText("Items");

        jMenuItem1.setText("Item Management");
        itemsMenu.add(jMenuItem1);

        menuBar.add(itemsMenu);

        reportsMenu.setText("Reports");

        salespersonRankingItem.setText("Salesperson Ranking");
        salespersonRankingItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salespersonRankingItemActionPerformed(evt);
            }
        });
        reportsMenu.add(salespersonRankingItem);

        viewUnredeemedAwards.setText("View Unredeemed Awards");
        reportsMenu.add(viewUnredeemedAwards);

        menuBar.add(reportsMenu);

        systemUtilitiesMenu.setText("System Utilities");

        printersAndDevices.setText("Printers and Devices");
        systemUtilitiesMenu.add(printersAndDevices);

        backupAndRecovery.setText("Backup and Recovery");
        systemUtilitiesMenu.add(backupAndRecovery);

        userAccountsSubMenu.setText("User Accounts");

        maintainAccounts.setText("Maintain Accounts");
        userAccountsSubMenu.add(maintainAccounts);

        changeCurrentUserPassword.setText("Change Current User Password");
        userAccountsSubMenu.add(changeCurrentUserPassword);

        systemUtilitiesMenu.add(userAccountsSubMenu);

        menuBar.add(systemUtilitiesMenu);

        userPreferencesMenu.setText("User Preferences");

        dialogStyle.setText("Dialog Style");
        userPreferencesMenu.add(dialogStyle);

        colorAndFont.setText("Color and Font");
        userPreferencesMenu.add(colorAndFont);

        shortcuts.setText("Shortcuts");
        userPreferencesMenu.add(shortcuts);

        macroFacility.setText("Macro Facility");
        userPreferencesMenu.add(macroFacility);

        menuBar.add(userPreferencesMenu);

        helpMenu.setText("Help");

        contentsAndIndex.setText("Contents and Index");
        helpMenu.add(contentsAndIndex);

        searchForHelp.setText("Search for Help");
        helpMenu.add(searchForHelp);

        taskList.setText("Task List");
        helpMenu.add(taskList);

        aboutTheMyStuffSystem.setText("About SLEEK");
        helpMenu.add(aboutTheMyStuffSystem);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        pack();
    }// //GEN-END:initComponents

  private void logoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutActionPerformed
    LoginDialog login = new LoginDialog();
    this.setVisible(false);
    login.setVisible(true);
    this.dispose();
  }//GEN-LAST:event_logoutActionPerformed

  private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed
    LoginDialog login = new LoginDialog();
    this.setVisible(false);
    login.setVisible(true);
    this.dispose();
  }//GEN-LAST:event_logoutButtonActionPerformed

  private void createNewMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createNewMemberActionPerformed
    AccountsFrame af = new AccountsFrame(ag);
    af.setVisible(true);
  }//GEN-LAST:event_createNewMemberActionPerformed

  private void salespersonRankingItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salespersonRankingItemActionPerformed
    PrintSalesRankingReport srr = new PrintSalesRankingReport(this, true);
    srr.setVisible(true);
  }//GEN-LAST:event_salespersonRankingItemActionPerformed

  /**
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    /** Set the Nimbus look and feel */
    //
        /** If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(SalespersonGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(SalespersonGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(SalespersonGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(SalespersonGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //

    /** Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {

      public void run() {
        new SalespersonGUI(new AccountGenerator()).setVisible(true);
      }
    });
  }
  //
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutTheMyStuffSystem;
    private javax.swing.JMenuItem backupAndRecovery;
    private javax.swing.JMenuItem changeCurrentUserPassword;
    private javax.swing.JMenuItem colorAndFont;
    private javax.swing.JMenuItem contentsAndIndex;
    private javax.swing.JMenuItem createNewMember;
    private javax.swing.JMenuItem createPrepackage;
    private javax.swing.JLabel currentUserLabel;
    private javax.swing.JMenuItem deletePrepackage;
    private javax.swing.JMenuItem dialogStyle;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JMenu itemsMenu;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem logout;
    private javax.swing.JButton logoutButton;
    private javax.swing.JMenuItem macroFacility;
    private javax.swing.JMenuItem maintainAccounts;
    private javax.swing.JMenu membershipMenu;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JLabel myStuffLogo;
    private javax.swing.JLabel newBusinessLabel;
    private javax.swing.JMenu prepackageManagementMenu;
    private javax.swing.JMenuItem printersAndDevices;
    private javax.swing.JMenu reportsMenu;
    private javax.swing.JMenuItem salespersonRankingItem;
    private javax.swing.JLabel salespersonUtilityLabel;
    private javax.swing.JMenuItem searchForHelp;
    private javax.swing.JMenuItem shortcuts;
    private javax.swing.JMenu systemUtilitiesMenu;
    private javax.swing.JMenuItem taskList;
    private javax.swing.JMenuItem updatePrepackage;
    private javax.swing.JMenuItem userAccounts;
    private javax.swing.JMenu userAccountsSubMenu;
    private javax.swing.JMenu userPreferencesMenu;
    private javax.swing.JMenuItem viewUnredeemedAwards;
    // End of variables declaration//GEN-END:variables
    //
}