@Override
	public void actionPerformed(ActionEvent e) {
		System.out.println("Event: Generic Action Performed/Main Event Listener");
		Object o = e.getSource();
		
		if (o instanceof JProgressBar) {
			
		} else if (o instanceof JCheckBox) {
			toggleAOT(((JCheckBox)e.getSource()).isSelected());
		} else if (o instanceof JToggleButton) { 
			onToggleRemove();
			return;
			
		} else if (o instanceof JButton) {
			if (((JButton) o).getName().equals("addTimerButton")) {
				try{
					
					String name = JOptionPane.showInputDialog(null, "Input a name for the timer.");	
					boolean isNormal = true;
					
					long dur;
					long startTime;
					
					if (name.startsWith("!")) {
						isNormal = false;
						name = name.substring(1);
						startTime = (long)(Math.floor(System.currentTimeMillis()/Main.DAY_LENGTH)*Main.DAY_LENGTH);
						dur = Main.DAY_LENGTH;
						
					} else if (name.startsWith("#")) {
						isNormal = false;
						name = name.substring(1);
						startTime = (long)(((Math.floor((System.currentTimeMillis()+Main.DAY_LENGTH)/Main.WEEK_LENGTH))*Main.WEEK_LENGTH)-Main.DAY_LENGTH);
						dur = Main.WEEK_LENGTH;
					} else {
						dur = 1000 * Integer.parseInt( JOptionPane.showInputDialog(null,"Input the timer's duration in seconds."));
						startTime = System.currentTimeMillis();
					}
					
					Main.addTimer(startTime, dur, getCurrentTimerTab(), isNormal, name);
					
					Main.saveTimers();
					
					} catch (NumberFormatException err) {
						err.printStackTrace();
						JOptionPane.showMessageDialog(null, "Could not add timer: Input not a number.");
					}
				
			
			} else if(((JButton) o).getName().equals("removeTabButton")) {
				
				int toRemove = this.getCurrentTimerTab();
				if (toRemove > 0 && toRemove < tabList.size()) {
					int doRemove = JOptionPane.showConfirmDialog(this, "Are you sure you want to remove the current tab?", "Confirm", JOptionPane.OK_CANCEL_OPTION);
					System.out.println(doRemove);
					
					if (doRemove == JOptionPane.OK_OPTION) {
				
						ArrayList<Timer> timerList = Main.getTimerList();
						
						for (int i = 0; i < timerList.size(); i++) {
							if (timerList.get(i).getTab() == toRemove) {
								Main.removeTimer(timerList.get(i).getName());
								i--;
							} else if (timerList.get(i).getTab() > toRemove) {
								timerList.get(i).setTab(timerList.get(i).getTab()-1);
							}
						}
						
						getTabList().get(toRemove).getParent().remove(getTabList().get(toRemove));
						getTabList().remove(toRemove);
						Main.saveTimers();
					}
				}
			} else if (((JButton) o).getName().equals("addTabButton")) {
				String tabName = JOptionPane.showInputDialog(null, "Input a name for the tab.");
				int tabRows = Integer.parseInt(JOptionPane.showInputDialog("Enter the number of rows for the tab.", this.getGridRows()));
				int tabColumns = Integer.parseInt(JOptionPane.showInputDialog("Enter the number of columns for the tab.", this.getGridColumns()));
				addNewTab(tabRows, tabColumns, tabName);
				Main.saveTimers();
			}
		}
		this.disableRemoveBar();
		
	}