@Override
	public void run() {
		try {
			boolean swapped = true;
			int i = 0;
			int j = list.length - 1;
			while (i < j && swapped) {
				swapped = false;
				for (int k = i; k < j; k++) {
					redColumn = k;
					repaint();
					Thread.sleep(4 * sleepTime);
					if (list[k] > list[k + 1]) {
						repaint();
						Thread.sleep(4 * sleepTime);
						int temp = list[k];
						list[k] = list[k + 1];
						list[k + 1] = temp;
						swapped = true;
					}
				}
				greenColumn2 = j;
				j--;
				if (swapped) {
					swapped = false;
					for (int k = j; k > i; k--) {
						redColumn = k;
						repaint();
						Thread.sleep(4 * sleepTime);
						if (list[k] < list[k - 1]) {
							repaint();
							Thread.sleep(4 * sleepTime);
							int temp = list[k];
							list[k] = list[k - 1];
							list[k - 1] = temp;
							swapped = true;
						}
					}
				}
				i++;
				greenColumn1 = i;
			}
			redColumn = -1;
			greenColumn1 = greenColumn2;
		} catch (InterruptedException e) {
		}
		repaint();
	}