Add/Edit Staff

Dashboard

Above UI we are going to create by Awt for Showing add staff window in our Attendance Management System desktop application. For that first we create a window and configure its title, size and color. Here we are creating a window at Top Level so we can add this window at the top of any other window.

    
            Background main =  new Background(winWidth/50,winHeight/40,winWidth-winWidth/20,winHeight-winHeight/10);
		    main.setPreferredSize(new Dimension(winWidth-winWidth/20,winHeight-winHeight/10));
		    

		    JFrame frame = new JFrame("Login");
		    frame.addWindowListener(new java.awt.event.WindowAdapter() {
	            @Override
	            public void windowClosing(java.awt.event.WindowEvent windowEvent) {
	            	 frame.dispose();
	            	 dashboardFrame.setVisible(true);
	            }
	        });	        
		    frame.pack();
			Utils.centeredFrame(frame, winWidth,winHeight, "Manage Staff");
	        frame.setVisible(true);
	        frame.setResizable(false);
	        Container mainContainer=frame.getContentPane();
	        mainContainer.setBackground(Color.gray);

	        JPanel panel = new JPanel();
	        panel.setLayout(null);
		    panel.setOpaque(false);
		    panel.setBackground(Color.BLACK);
		    panel.setSize(new Dimension(winWidth-winWidth/20,winHeight-winHeight/10));
		    panel.setLocation(winWidth/50,winHeight/40);
		    mainContainer.add(panel,BorderLayout.CENTER);

		    JComponent jcomponent=new Background(winWidth/50,winHeight/40,winWidth-winWidth/20,winHeight-winHeight/10);// 
	        mainContainer.add(jcomponent,BorderLayout.CENTER);
    

Here we create Label for our heading.

    
            //header
            heading=new JLabel();
	        heading.setText("Add/Edit Staff");
	        heading.setForeground(Color.black);
	        heading.setFont(new Font("Lucida",Font.PLAIN,40));
	        heading.setSize(new Dimension(winWidth/3,winHeight/10));
	        heading.setHorizontalAlignment(JLabel.CENTER);
	        header.add(heading,BorderLayout.CENTER);

            //Panels         
            JPanel header =  Utils.createPanel(winWidth*91/100,winHeight/10,new Point(winWidth/50,winHeight/40), true,"");
	        panel.add(header,BorderLayout.NORTH);
	        header.setLayout(new BorderLayout());

	        JPanel ledtside =  Utils.createPanel(winWidth/3,winHeight*7/10,new Point(winWidth/50,winHeight/6), true,"Action");
	        panel.add(ledtside,BorderLayout.NORTH);
	        ledtside.setLayout(null);
	        
	        JPanel rightside =  Utils.createPanel(winWidth*57/100,winHeight*7/10,new Point(winWidth/3+winWidth/30,winHeight/6), true,"Staff Details");
	        panel.add(rightside,BorderLayout.WEST);
	        rightside.setLayout(null);

            Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
	        
            //Labels on action panel

	        TitledBorder usernametittle = BorderFactory.createTitledBorder(loweredetched, "Staff Name");
	        usernametittle.setTitleJustification(TitledBorder.LEFT);
	        
	        TitledBorder emailtittle = BorderFactory.createTitledBorder(loweredetched, "Email");
	        emailtittle.setTitleJustification(TitledBorder.LEFT);
	        
	        TitledBorder phoneTittle = BorderFactory.createTitledBorder(loweredetched, "Contact No");
	        phoneTittle.setTitleJustification(TitledBorder.LEFT);
	        
	        TitledBorder searchTittle = BorderFactory.createTitledBorder(loweredetched, "Search");
	        searchTittle.setTitleJustification(TitledBorder.LEFT);
	        
            TitledBorder passwordTittled = BorderFactory.createTitledBorder(loweredetched, "Working hour");
            passwordTittled.setTitleJustification(TitledBorder.LEFT);

            name=new JLabel();
            name.setText("Enter Staff Name");
            name.setForeground(Color.black);
            name.setFont(new Font("Lucida",Font.PLAIN,12));
            name.setSize(new Dimension(winWidth/3,winHeight/10));
            name.setLocation(30, winHeight/100-winHeight/60); 
	        ledtside.add(name);

	        myTextField = new JTextField();
	        myTextField.setSize(new Dimension(winWidth*3/10,winHeight/15));
	        myTextField.setLocation(30,winHeight/12-winHeight/60);	
	        myTextField.setBorder(usernametittle);
	        ledtside.add(myTextField,BorderLayout.SOUTH);

	        email=new JLabel();
	        email.setText("Enter Email");
	        email.setForeground(Color.black);
	        email.setFont(new Font("Lucida",Font.PLAIN,12));
	        email.setSize(new Dimension(winWidth/3,winHeight/10));
	        email.setLocation(30, winHeight/7-winHeight/60); 
	        ledtside.add(email);

	        emailField = new JTextField();
	        emailField.setSize(new Dimension(winWidth*3/10,winHeight/15));
	        emailField.setLocation(30,winHeight/5+winHeight/100-winHeight/60);	
	        emailField.setBorder(emailtittle);
	        ledtside.add(emailField,BorderLayout.SOUTH);

	        phone=new JLabel();
	        phone.setText("Enter Contact No");
	        phone.setForeground(Color.black);
	        phone.setFont(new Font("Lucida",Font.PLAIN,12));
	        phone.setSize(new Dimension(winWidth/3,winHeight/10));
	        phone.setLocation(30, winHeight/4+winHeight/70-winHeight/60); 
	        ledtside.add(phone);

	        phonetextField = new JTextField();
	        phonetextField.setSize(new Dimension(winWidth*3/10,winHeight/15));
	        phonetextField.setLocation(30,winHeight/3-winHeight/60);	
	        phonetextField.setBorder(phoneTittle);
	        ledtside.add(phonetextField,BorderLayout.SOUTH);

	        workingHour=new JLabel();
	        workingHour.setText("Working Hour");
	        workingHour.setForeground(Color.black);
	        workingHour.setFont(new Font("Lucida",Font.PLAIN,12));
	        workingHour.setSize(new Dimension(winWidth/3,winHeight/10));
	        workingHour.setLocation(30, winHeight/2-winHeight/10-winHeight/30); 
	        ledtside.add(workingHour);

	        workingHourTextField = new JTextField();
	        workingHourTextField.setSize(new Dimension(winWidth*3/10,winHeight/15));
	        workingHourTextField.setLocation(30, winHeight/2- winHeight/30-winHeight/30);	
	        workingHourTextField.setBorder(passwordTittled);
	        ledtside.add(workingHourTextField,BorderLayout.SOUTH);
	        
	        paymentMode=new JLabel();
	        paymentMode.setText("Select payment Mode");
	        paymentMode.setForeground(Color.black);
	        paymentMode.setFont(new Font("Lucida",Font.PLAIN,12));
	        paymentMode.setSize(new Dimension(winWidth/3,winHeight/10));
	        paymentMode.setLocation(30, winHeight/2-winHeight/60); 
	        ledtside.add(paymentMode);
	        
	        String country[]={"Monthly","Daily"};        
	        JComboBox cb=new JComboBox(country);    
	        cb.setSize(new Dimension(winWidth*3/10,winHeight/25));
	        cb.setLocation(30, winHeight/2+winHeight/20);	
	        ledtside.add(cb);

   

Here we create "Add Staff" button on action Panel.

    
            JButton addstaffButton = new JButton(new ImageIcon(((new ImageIcon("images/button37.png")).getImage()).getScaledInstance(200, 50, java.awt.Image.SCALE_SMOOTH)));
	        addstaffButton.setContentAreaFilled(false);
	        addstaffButton.setBorder(null);
	        addstaffButton.setText("Add staff");
	        addstaffButton.setForeground(Color.white);
	        addstaffButton.setFont(new Font("Lucida",Font.PLAIN,16));
	        addstaffButton.setHorizontalTextPosition(JButton.CENTER);
	        addstaffButton.setVerticalTextPosition(JButton.CENTER);
	        addstaffButton.setBounds(winWidth/6-100,winHeight/2+ winHeight/9,200,50);  
	        addstaffButton.setVisible(true);  
	        addstaffButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

	        ledtside.add(addstaffButton);
	        addstaffButton.addActionListener(new ActionListener() {
	            @Override
	            public void actionPerformed(ActionEvent ae) {
	            	
	            	String nameString="";
	            	String emailString="";
	            	String contactString="";
	            	String passwordtString="";

	               String var="";
          		   if(myTextField.getText().isEmpty()){
          			   var=var+"Name shouldnot be Empty, ";
          			   
          		   }else{
          			 nameString=myTextField.getText().toString();
          		   }
          		   
          		 if(emailField.getText().isEmpty()){
        			   var=var+"Email shouldnot be Empty, ";
        			   
        		   }else{
        			   emailString=emailField.getText().toString();
        		   }
          		if(phonetextField.getText().isEmpty()){
     			   var=var+"Email shouldnot be Empty, ";
     			   
     		   }else{
     			  contactString=phonetextField.getText().toString();
     		   }
          		if(workingHourTextField.getText().isEmpty()){
      			   var=var+"Email shouldnot be Empty ";
      			   
      		   }else{
      			 passwordtString=workingHourTextField.getText().toString();
      		   }
          		   
           		String paymentMode=cb.getSelectedItem().toString();        		   
          		   
           		if(var==""){
           			
          			   	String stafflastCount= getStafflastCount();
	            		   
	            		String staff_id_String = "STF";
	            		   DecimalFormat df = new DecimalFormat("000");
	            		   String generatedID=staff_id_String+df.format(Integer.parseInt(stafflastCount));
	            		   
	            		  boolean isSussessFullEntered=tableIntryField(generatedID,nameString,emailString,contactString,passwordtString,paymentMode);
	            		  if(isSussessFullEntered){
	            			  
	            			  updateLastCount(Integer.parseInt(stafflastCount)+1);
	            			  myTextField.setText("");
	            			  emailField.setText("");
	            			  phonetextField.setText("");
	            			  workingHourTextField.setText("");
	            			  
	            			  displaylistToTable(table,getTableListData());

	               			 JOptionPane.showMessageDialog(frame, "Successfully Enterd");

	            			  
	            		  }else{
		               			 JOptionPane.showMessageDialog(frame, "Not Enterd");
	            		  }           	  
          			   
          		   }else{
          			 JOptionPane.showMessageDialog(frame, var);

          		   }
           		}
	        });	        
    

Here we create Labels on Staff Details Panel.

    
            search=new JLabel();
		    search.setText("Search staff");
	        search.setForeground(Color.black);
		    workingHour.setFont(new Font("Lucida",Font.PLAIN,12));
	        search.setSize(new Dimension(winWidth/4,winHeight/10));
		    search.setLocation(30, 0); 
		    rightside.add(search);
		        
		        
		    searchTextField = new JTextField();
		    searchTextField.setSize(new Dimension(winWidth/4,winHeight/15));
            searchTextField.setLocation(30,65);	
		    searchTextField.setBorder(searchTittle);
		    rightside.add(searchTextField);

    

Here the logic behind search.

    
                searchTextField.getDocument().addDocumentListener(new DocumentListener() {
			         @Override
			         public void insertUpdate(DocumentEvent e) {
			            search(searchTextField.getText());
			            
			         }
			         @Override
			         public void removeUpdate(DocumentEvent e) {
			            search(searchTextField.getText());
			         }
			         @Override
			         public void changedUpdate(DocumentEvent e) {
			            search(searchTextField.getText());
			         }
			         public void search(String str) {
			            if (str.length() == 0) {
			  			  displaylistToTable(table,getTableListData());
			            } else {
			            	defaultdataModel.setRowCount(0);
				  			  displaylistToTable(table,getselectedTableListData(str));
			            }
			         }
			      });

                public ArrayList getselectedTableListData(String data){
                    ArrayList staffList=new ArrayList();
	 
	                ResultSet rs;
	                String query = "SELECT * FROM staff_data WHERE staff_id LIKE '%" + data + "%' or staff_name LIKE '%" + data + "%' " ;
                    Connection conn = SQLiteJDBCDriverConnection.connect1();
                    Statement stat = null;
		            try {
			        stat = conn.createStatement();
			        rs = stat.executeQuery(query);
			        StaffData staffdata;
			        while(rs.next()){
				        staffdata=new StaffData(rs.getString("staff_id"), rs.getString("staff_name"), rs.getString("staff_email_id"), rs.getString("staff_contact_no"));
				        staffList.add(staffdata);
			        }
			 
			        rs.close();
			        stat.close();
		            conn.close();  
		          } catch (SQLException e1) {
			        // TODO Auto-generated catch block
			        e1.printStackTrace();
                  }

	             return staffList;
	 
                } 
    

Here we create table entry field.


        public boolean tableIntryField(String generatedID, String nameString, String emailString, String contactString,
			String passwordtString,String paymentMode) {
		 
		 		conn=SQLiteJDBCDriverConnection.connect1();
	            boolean issuccess=false;
	            Statement stmt = null;
	            int action;

		        
		        String sql = "INSERT INTO staff_data (staff_id, staff_name, staff_contact_no, staff_email_id,payment_mode,working_hour,is_present ) " +
                        "VALUES (?,?,?,?,?,?,?);"; 
        
		        PreparedStatement pst  = null;
		        ResultSet rs = null;
		        try {
		                pst = conn.prepareStatement(sql);
		                pst.setString(1, generatedID);
		                pst.setString(2, nameString);
			            pst.setString(3, contactString);
			            pst.setString(4, emailString);
			            pst.setString(5, paymentMode);
			            pst.setString(6, passwordtString);
			            pst.setString(7, "absent");

			            action = pst.executeUpdate();
			            if(action>0){
					    	   issuccess= true;
			 
					       }else{
					    	   issuccess= false;

					       }
			           
		            } catch (Exception a) {
		                a.printStackTrace();
		            } finally {
		                if(rs != null){
		                     try{
		                          rs.close();
		                     } catch(Exception e){
		                         e.printStackTrace();
		                     }
		                }
		                if(pst != null){
		                    try{
		                        pst.close();
		                    } catch(Exception e){
		                        e.printStackTrace();
		                    }
		                }
		            }
    		       return issuccess;
	}


After Table creation we need to fetch the data from database and display in table.


public ArrayList getTableListData(){
	 ArrayList staffList=new ArrayList();
		 
		  ResultSet rs;
		  String query = "SELECT * FROM staff_data;" ;
	      conn = SQLiteJDBCDriverConnection.connect1();
	     
	      
	      Statement stat = null;
			try {
				stat = conn.createStatement();
				 rs = stat.executeQuery(query);
				 StaffData staffdata;
				 while(rs.next()){
					 staffdata=new StaffData(rs.getString("staff_id"), rs.getString("staff_name"), rs.getString("staff_email_id"), rs.getString("staff_contact_no"));
					 staffList.add(staffdata);
				 }
				 
				   

			} catch (SQLException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
      

		  return staffList;
		 
	 }
 
 
 public void displaylistToTable(JTable table,ArrayList staffList){
	 
	 defaultdataModel=new DefaultTableModel(){
		 @Override
		    public boolean isCellEditable(int row, int column) {
		       return false;
		    }
	 };
	 Object []row=new Object[5];

	 defaultdataModel.setColumnIdentifiers(new Object[]{"ID","Name","Email","Contact No"});
	 
	 for (int i = 0; i < staffList.size(); i++) {

		 row[0]=staffList.get(i).getId();
		 row[1]=staffList.get(i).getStaffName();
		 row[2]=staffList.get(i).getStaffEmail();
		 row[3]=staffList.get(i).getStaffContactNo();
		 defaultdataModel.addRow(row);


	}
	 
	  table.setModel(defaultdataModel);
	  DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
      centerRenderer.setHorizontalAlignment( JLabel.CENTER );
	  table.getColumnModel().getColumn(0).setCellRenderer( centerRenderer );
	  table.getColumnModel().getColumn(1).setCellRenderer( centerRenderer );
	  table.getColumnModel().getColumn(2).setCellRenderer( centerRenderer );
	  table.getColumnModel().getColumn(3).setCellRenderer( centerRenderer );

	  table.getColumnModel().getColumn(1).setPreferredWidth(200);
      table.getColumnModel().getColumn(2).setPreferredWidth(150);

    

when we select any record these buttons are available.

    

                editButton =  new JButton(new ImageIcon(((new ImageIcon("images/button37.png")).getImage()).getScaledInstance(120, 35, java.awt.Image.SCALE_SMOOTH)));
				editButton.setContentAreaFilled(false);
				editButton.setBorder(null);
				editButton.setText("Edit");
				editButton.setForeground(Color.white);
				editButton.setFont(new Font("Lucida",Font.PLAIN,16));
				editButton.setHorizontalTextPosition(JButton.CENTER);
				editButton.setVerticalTextPosition(JButton.CENTER);
				editButton.setBounds(winWidth/3-90,70,150,35);  
		        rightside.add(editButton);
		        editButton.setVisible(false);
		        editButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
		        editButton.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						int row = table.getSelectedRow();

						if(row == -1)
						{
						   JOptionPane.showMessageDialog(dashboardFrame, "Please selecet Staff");
						}
						else
						{
							addstaffButton.setVisible(false);
					        cancleButton.setVisible(true);
					        updateButton.setVisible(true);
					        
							myTextField.setText(table.getValueAt(table.getSelectedRow(), 1).toString());
							emailField.setText(table.getValueAt(table.getSelectedRow(), 2).toString());
							phonetextField.setText(table.getValueAt(table.getSelectedRow(), 3).toString());
							String workingHour=getWorkingHour(table.getValueAt(table.getSelectedRow(), 0).toString());
							workingHourTextField.setText(workingHour);
							String paymentMode=getPaymentMode(table.getValueAt(table.getSelectedRow(), 0).toString());
							if(paymentMode.equalsIgnoreCase("Monthly")){
								cb.setSelectedIndex(0);

							}else{
								cb.setSelectedIndex(1);

							}
						    
						    // do whatever you need to do with the data from the row
						}
                    }
				});

		        deleteButton=new JButton(new ImageIcon(((new ImageIcon("images/button37.png")).getImage()).getScaledInstance(120, 35, java.awt.Image.SCALE_SMOOTH)));
		        deleteButton.setContentAreaFilled(false);
		        deleteButton.setBorder(null);
		        deleteButton.setText("Delete");
		        deleteButton.setForeground(Color.white);
		        deleteButton.setFont(new Font("Lucida",Font.PLAIN,16));
		        deleteButton.setHorizontalTextPosition(JButton.CENTER);
		        deleteButton.setVerticalTextPosition(JButton.CENTER);
		        deleteButton.setBounds(winWidth*2/5-45,70,150,35);  
		        rightside.add(deleteButton);
		        deleteButton.setVisible(false);	
		        deleteButton.setCursor(new Cursor(Cursor.HAND_CURSOR));

		        deleteButton.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						
						boolean isSuccessdelete=deletedataFromTable(table.getValueAt(table.getSelectedRow(), 0).toString());
						if(isSuccessdelete){
					        JOptionPane.showMessageDialog(null, "Record deleted..."); 
							  displaylistToTable(table,getTableListData());


						}else{
					        JOptionPane.showMessageDialog(null, "Not deleted...");  

						}

					}

					
				});
		        
		        paymentButton=new JButton(new ImageIcon(((new ImageIcon("images/button37.png")).getImage()).getScaledInstance(120, 35, java.awt.Image.SCALE_SMOOTH)));
		        paymentButton.setContentAreaFilled(false);
		        paymentButton.setBorder(null);
		        paymentButton.setText("Payment");
		        paymentButton.setForeground(Color.white);
		        paymentButton.setFont(new Font("Lucida",Font.PLAIN,16));
		        paymentButton.setHorizontalTextPosition(JButton.CENTER);
		        paymentButton.setVerticalTextPosition(JButton.CENTER);
		        paymentButton.setBounds(winWidth/2-50,70,150,35);  
		        rightside.add(paymentButton);
		        paymentButton.setVisible(false);	
		        paymentButton.setCursor(new Cursor(Cursor.HAND_CURSOR));

		        paymentButton.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						
						int row = table.getSelectedRow();

						if(row == -1)
						{
						   JOptionPane.showMessageDialog(dashboardFrame, "Please selecet Staff");
						}
						else
						{
							addstaffButton.setVisible(false);
					        cancleButton.setVisible(true);
					        updateButton.setVisible(true);

							dashboardFrame.setVisible(false);
							new PaymentPage(dashboardFrame, totalWinWidth, totalWinHeight,table.getValueAt(table.getSelectedRow(), 0).toString());
						    
						    // do whatever you need to do with the data from the row
						}
                    }
		        });
	        panel.revalidate();
	        panel.repaint();

    

when we click on "EDIT" button these button are shoown in action panel.

    
            JButton updateButton = new JButton(new ImageIcon(((new ImageIcon("images/button37.png")).getImage()).getScaledInstance(200, 50, java.awt.Image.SCALE_SMOOTH)));
	        updateButton.setContentAreaFilled(false);
	        updateButton.setBorder(null);
	        updateButton.setText("Update");
	        updateButton.setForeground(Color.white);
	        updateButton.setFont(new Font("Lucida",Font.PLAIN,16));
	        updateButton.setHorizontalTextPosition(JButton.CENTER);
	        updateButton.setVerticalTextPosition(JButton.CENTER);
	        updateButton.setBounds(30,winHeight/2+ winHeight/9 ,200,50);  
	        updateButton.setVisible(false);
	        updateButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

	        ledtside.add(updateButton);
     
			updateButton.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
					String nameString="";
	            	String emailString="";
	            	String contactString="";
	            	String passwordtString="";

	               String var="";
          		   if(myTextField.getText().isEmpty()){
          			   var=var+"Name shouldnot be Empty, ";
          			   
          		   }else{
          			 nameString=myTextField.getText().toString();
          		   }
          		   
          		   
          		 if(emailField.getText().isEmpty()){
        			   var=var+"Email shouldnot be Empty, ";
        			   
        		   }else{
        			   emailString=emailField.getText().toString();
        		   }
          		if(phonetextField.getText().isEmpty()){
     			   var=var+"Email shouldnot be Empty, ";
     			   
     		   }else{
     			  contactString=phonetextField.getText().toString();
     		   }
          		if(workingHourTextField.getText().isEmpty()){
      			   var=var+"Email shouldnot be Empty ";
      			   
      		   }else{
      			 passwordtString=workingHourTextField.getText().toString();
      		   }

          		   if(var==""){
            		    String generatedID=table.getValueAt(table.getSelectedRow(), 0).toString();      		  
                   		String paymentMode=cb.getSelectedItem().toString();

	            		   
	            		boolean isSussessFullEntered=updatetableIntryField(generatedID,nameString,emailString,contactString,passwordtString,paymentMode);
	            		if(isSussessFullEntered){
	            			  
	            			myTextField.setText("");
	            			emailField.setText("");
	            			phonetextField.setText("");
	            			workingHourTextField.setText("");
	            			  
	            			displaylistToTable(table,getTableListData());

	               			JOptionPane.showMessageDialog(frame, "Successfull Updated");

	            			  
	            		  }else{
		               			 JOptionPane.showMessageDialog(frame, "Not Update");

	            			  
	            		  }

	            	    }else{
          			 JOptionPane.showMessageDialog(frame, var);

          		   }

				}
			});
	        

	        JButton cancleButton = new JButton(new ImageIcon(((new ImageIcon("images/button37.png")).getImage()).getScaledInstance(200, 50, java.awt.Image.SCALE_SMOOTH)));
	        cancleButton.setContentAreaFilled(false);
	        cancleButton.setBorder(null);
	        cancleButton.setText("Cancle");
	        cancleButton.setForeground(Color.white);
	        cancleButton.setFont(new Font("Lucida",Font.PLAIN,16));
	        cancleButton.setHorizontalTextPosition(JButton.CENTER);
	        cancleButton.setVerticalTextPosition(JButton.CENTER);
	        cancleButton.setBounds(winWidth/3-200-30,winHeight/2+ winHeight/9,200,50);  
	        cancleButton.setVisible(false);        
	        cancleButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

	        ledtside.add(cancleButton);

	        cancleButton.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
					
					    addstaffButton.setVisible(true);
					    editButton.setVisible(false);
					    deleteButton.setVisible(false);
				        cancleButton.setVisible(false);
				        updateButton.setVisible(false);
				        myTextField.setText("");
						emailField.setText("");
						phonetextField.setText("");
						workingHourTextField.setText("");
				}

			});


    

Programmer Mirta is for learning and training. Projects might be simple to improve learning. Projects are constantly reviewed to avoid errors, but we cannot assure full correctness of all content. While using Programmer Mitra, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 2021 by Programmer Mitra. All Rights Reserved.