/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package scheduler.schedule_menu; /* * PrototypeGUI.java * * Created on Nov 22, 2009, 5:01:35 PM */ /** * * @author jsoliman */ public class PrototypeGUI extends javax.swing.JFrame { /** Creates new form PrototypeGUI */ public PrototypeGUI() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); instructorList = new javax.swing.JList(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); Name = new javax.swing.JLabel(); id = new javax.swing.JLabel(); wtus = new javax.swing.JLabel(); officeNumber = new javax.swing.JLabel(); disabilities = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Instructors"); instructorList.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Fisher, Gene", "Mammen, Kurt", "Nico, Phillip", "Seng, John", "Workman, Julie", " " }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); instructorList.setVisibleRowCount(10); instructorList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { instructorListValueChanged(evt); } }); jScrollPane1.setViewportView(instructorList); jLabel1.setText("Instructor List"); jButton1.setText("Add Instructor"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); Name.setText(" "); id.setText(" "); wtus.setText(" "); officeNumber.setText(" "); disabilities.setText(" "); jLabel2.setText("Name"); jLabel3.setText("ID"); jLabel4.setText("WTUs"); jLabel5.setText("Office Number"); jLabel6.setText("Disabilities"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2) .addComponent(jLabel4)) .addComponent(jLabel5) .addComponent(jLabel3) .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(id) .addComponent(Name) .addComponent(wtus) .addComponent(officeNumber) .addComponent(disabilities)))) .addContainerGap(134, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(Name) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(id) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(wtus) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(officeNumber) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(disabilities) .addComponent(jLabel6)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// //GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: new AddInstructor().setVisible(true); }//GEN-LAST:event_jButton1ActionPerformed private void instructorListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_instructorListValueChanged if (!evt.getValueIsAdjusting()) { String selection = instructorList.getSelectedValue().toString(); Name.setText(selection); if (selection.equals("Fisher, Gene")) { disabilities.setText("No"); id.setText("gfisher"); officeNumber.setText("210"); wtus.setText("12"); } else if (selection.equals("Mammen, Kurt")) { disabilities.setText("No"); id.setText("kmammen"); officeNumber.setText("228"); wtus.setText("12"); } else if (selection.equals("Nico, Phillip")) { disabilities.setText("No"); id.setText("pnico"); officeNumber.setText("205"); wtus.setText("12"); } else if (selection.equals("Workman, Julie")) { disabilities.setText("No"); id.setText("jworkman"); officeNumber.setText("206"); wtus.setText("12"); } else if (selection.equals("Seng, John")) { disabilities.setText("No"); id.setText("jseng"); officeNumber.setText("231"); wtus.setText("0"); } } }//GEN-LAST:event_instructorListValueChanged /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PrototypeGUI().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel Name; private javax.swing.JLabel disabilities; private javax.swing.JLabel id; private javax.swing.JList instructorList; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel officeNumber; private javax.swing.JLabel wtus; // End of variables declaration//GEN-END:variables }