private void addItemInstructionsView(DocumentItemApi toAdd) { File image; // If the image has been changed if (imageChanged) { try { image = ((InstructionsView) this).getImageFile(); // If the question is associated with an image if (image != null) { toAdd.setImage(image); } } catch (IOException e) { JOptionPane.showMessageDialog(null, "Instruction contains a " + "bad file"); } } else { toAdd.setShallowImage(item); } }