public static void main(String[] args) { IDoor door = new SingleDoor(); JFrame j = new JFrame(); j.add(door.createDoorUI()); j.setVisible(true); synchronized (door) { door.openDoor(); try { door.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }