package gui.processors; import javax.swing.JLabel; /** * * @author mark */ public class Student { private final Integer seat; private Status status = Status.NONE; private final JLabel label; public Student(Integer seat, JLabel label) { this.seat = seat; this.label = label; } public synchronized void addStatus(Status newStatus) { // do nothing if new status is same as current status if (status == newStatus) { return; } if (status == Status.NONE) { status = newStatus; } else { status = Status.BOTH; } updateColour(); } public synchronized void removeStatus(Status newStatus) { if (status == Status.BOTH) { // set status to opposite of one being removed status = newStatus == Status.HELP ? Status.MARKING : Status.HELP; } else if (status == newStatus) { status = Status.NONE; } updateColour(); } public Status getStatus() { return status; } private void updateColour() { System.out.println("setting color"); label.setBackground(status.getColour()); } }