Update gui.java

flawed code, needs improvement.