@SuppressWarnings("deprecation")
	public void actionPerformed(ActionEvent e)//makes button do what they are suppost to do
	{
		
		StringBuilder inputPin = new StringBuilder(jpwPasscode.getText());
		if(e.getSource()==jbtButton1||e.getSource()==jbtButton2||e.getSource()==jbtButton3||e.getSource()==jbtButton4||e.getSource()==jbtButton5||e.getSource()==jbtButton6||e.getSource()==jbtButton7||e.getSource()==jbtButton8||e.getSource()==jbtButton9||e.getSource()==jbtButton0||e.getSource()==jbtClearPowerOff||e.getSource()==jbtNewUser)
		{
			if(e.getSource()==jbtClearPowerOff)
			{
				if(jbtClearPowerOff.getText().equals("Delete"))
				{
					if(!(jpwPasscode.getText().equals("")))
					{
						String text = jpwPasscode.getText();
						text = text.substring(0,text.length()-1);
						System.out.println(text);
						jpwPasscode.setText(text);
						inputPin = new StringBuilder(text);
					}
					if(jpwPasscode.getText().equals(""))
					{
						jbtClearPowerOff.setText("Power Off");
					}
					timer.stop();
					screenSaver saver = new screenSaver();
				}
				else if(jbtClearPowerOff.getText().equals("Delete All"))//deletes all when text is length of 4
				{
					if(!(jpwPasscode.getText().equals("")))
					{
						String text = "";
						System.out.println(text);
						jpwPasscode.setText(text);
						inputPin = new StringBuilder(text);
					}
					if(jpwPasscode.getText().equals(""))
					{
						jbtClearPowerOff.setText("Power Off");
					}
					timer.stop();
					screenSaver saver = new screenSaver();
				}
				else if(jbtClearPowerOff.getText().equals("Power Off"))
				{
					System.exit(0);
				}
			}
			else if(e.getSource()==jbtNewUser)
			{
				timer.stop();
				int adminPasscode = Integer.parseInt(JOptionPane.showInputDialog(null,"Insert Admin Passcode"));
				if(isAdmin(adminPasscode))
				{
					newUserAndPasword user = new newUserAndPasword();
				}
				else
					JOptionPane.showMessageDialog(null, "Passcode Incorrect");
			}
//			else if(e.getSource()==jbtExit)
//			{
//				System.exit(0);
//			}
			else if (inputPin.length()<4)//keeps password field to 4 numbers 
			{
				//adds number to password field according to button
				if(e.getSource()==jbtButton1)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="1";
					else
						text = text+"1";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton2)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="2";
					else
						text = text+"2";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton3)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="3";
					else
						text = text+"3";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton4)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="4";
					else
						text = text+"4";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton5)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="5";
					else
						text = text+"5";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton6)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="6";
					else
						text = text+"6";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton7)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="7";
					else
						text = text+"7";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton8)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="8";
					else
						text = text+"8";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton9)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="9";
					else
						text = text+"9";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
				else if(e.getSource()==jbtButton0)
				{
					jbtClearPowerOff.setText("Delete");
					@SuppressWarnings("deprecation")
					String text = jpwPasscode.getText();
					if (text==null)
						text="0";
					else
						text = text+"0";
					jpwPasscode.setText(text);
					System.out.println(text);
				}
			}
		}
	}