private void searchTeamButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_searchTeamButtonActionPerformed // TODO add your handling code here: String name = teamMemberComboBox.getSelectedItem().toString(); Object[] array = new Object[3]; List<TeamMember> team1ResultList; team1ResultList = model.getList(); for (TeamMember ele : team1ResultList) { if (ele.getMemberName().equals(name)) { id = ele.getMemberId(); NameTextField.setText(ele.getMemberName()); EmailTextField.setText(ele.getContact()); System.out.println(ele.getMemberId().intValue()); } } } // GEN-LAST:event_searchTeamButtonActionPerformed
// public String[] getValues() // { // // String[] a = teamqueryController.getValues(); // NameTextField.setText(a[0]); // EmailTextField.setText(a[1]); // return a; // // } private void UpdateButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_UpdateButtonActionPerformed // TODO add your handling code here: Object[] array = new Object[3]; // List<TeamMember> team1ResultList; // team1ResultList= model.getList(); // for(TeamMember ele : team1ResultList){ // if(ele.getMemberName().equals(NameTextField.getText())){ // array[0] = ele.getMemberId(); // System.out.println(ele.getMemberId().intValue()); // } // } array[0] = id; array[1] = NameTextField.getText(); array[2] = EmailTextField.getText(); teamqueryController.addRow(array); ((TeamQueryTableModel) jtable1.getModel()).fireTableDataChanged(); } // GEN-LAST:event_UpdateButtonActionPerformed
/** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); NameTextField = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); EmailTextField = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); // DeleteButton = new javax.swing.JButton(); UpdateButton = new javax.swing.JButton(); jLabel7 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jButton5 = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); teamMemberComboBox = new javax.swing.JComboBox(); searchTeamButton = new javax.swing.JButton(); jButton1.setText("jButton1"); jTable1.setModel( new javax.swing.table.DefaultTableModel( new Object[][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String[] {"Title 1", "Title 2", "Title 3", "Title 4"})); jScrollPane1.setViewportView(jTable1); setBackground(new java.awt.Color(255, 255, 255)); // jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource())); // NOI18N jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 0, 0))); jLabel2.setBackground(new java.awt.Color(255, 255, 255)); jLabel2.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N jLabel2.setText(" Name "); NameTextField.setBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0))); jLabel3.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N jLabel3.setText(" Email - id "); EmailTextField.setBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0))); // jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/scusymbol.PNG"))); // // NOI18N jPanel2.setBackground(new java.awt.Color(255, 255, 255)); jPanel2.setBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); // DeleteButton.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N // DeleteButton.setText("Delete ExistingEntry"); // DeleteButton.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(java.awt.event.ActionEvent evt) { // DeleteButtonActionPerformed(evt); // } // }); UpdateButton.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N UpdateButton.setText("Update ExistingEntry"); UpdateButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { UpdateButtonActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addComponent(UpdateButton) .addGap(26, 26, 26) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( jPanel2Layout .createSequentialGroup() .addContainerGap() .addGroup( jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) // .addComponent(DeleteButton) .addComponent(UpdateButton)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); // jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/i1.PNG"))); // // NOI18N // // jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/i2.PNG"))); // // NOI18N // // jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/i3.PNG"))); // // NOI18N // // jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/i4.PNG"))); // // NOI18N // // jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/hom.PNG"))); // // NOI18N jButton5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0))); jButton5.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 415, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 147, Short.MAX_VALUE)); jTextField1.setBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255))); jTextField1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); teamMemberComboBox.setModel( new javax.swing.DefaultComboBoxModel(new String[] {"<Select Team Member>"})); searchTeamButton.setText("Search Team"); searchTeamButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchTeamButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addComponent( jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE) .addGap(1071, 1071, 1071)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(124, 124, 124) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5) .addGap(55, 55, 55)) .addGroup( layout .createSequentialGroup() .addGap(343, 343, 343) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(63, 63, 63) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING, false) .addComponent( jLabel2, javax.swing.GroupLayout.Alignment .TRAILING, javax.swing.GroupLayout .PREFERRED_SIZE, 111, javax.swing.GroupLayout .PREFERRED_SIZE) .addGroup( layout .createSequentialGroup() .addComponent( jTextField1, javax.swing.GroupLayout .PREFERRED_SIZE, 27, javax.swing.GroupLayout .PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle .ComponentPlacement .RELATED, javax.swing.GroupLayout .DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jLabel3, javax.swing.GroupLayout .PREFERRED_SIZE, 111, javax.swing.GroupLayout .PREFERRED_SIZE)))) .addGroup( layout .createSequentialGroup() .addGap(106, 106, 106) .addComponent( teamMemberComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(searchTeamButton) .addComponent( EmailTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 551, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( NameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 551, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jButton5) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(10, 10, 10) .addComponent( jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(10, 10, 10) .addComponent(jLabel1) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( teamMemberComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(searchTeamButton)) .addGap(22, 22, 22) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( NameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(468, 468, 468) .addComponent(jLabel5)) .addGroup( layout .createSequentialGroup() .addGap(27, 27, 27) .addComponent( jTextField1, javax.swing.GroupLayout .PREFERRED_SIZE, javax.swing.GroupLayout .DEFAULT_SIZE, javax.swing.GroupLayout .PREFERRED_SIZE))) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .BASELINE) .addComponent( EmailTextField, javax.swing.GroupLayout .PREFERRED_SIZE, 28, javax.swing.GroupLayout .PREFERRED_SIZE) .addComponent( jLabel3, javax.swing.GroupLayout .PREFERRED_SIZE, 28, javax.swing.GroupLayout .PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent( jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement .RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(121, 121, 121)))) .addGroup( layout .createSequentialGroup() .addComponent(jLabel7) .addGap(0, 0, 0) .addComponent(jLabel6) .addGap(0, 0, 0) .addComponent(jLabel8) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel9))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); } // </editor-fold>//GEN-END:initComponents
public void setMemberName(String value) { NameTextField.setText(value); }