public void setFolderViewed(String folderViewed, String notesFile) { this.folderViewed = folderViewed; this.notesFile = notesFile; if (folderViewed == null || notesFile == null) { JLabel noLabel = new JLabel("No notes available at this level"); notespane.setLayout(new BoxLayout(notespane, BoxLayout.PAGE_AXIS)); notespane.removeAll(); notespane.add(Box.createVerticalGlue()); notespane.add(noLabel); notespane.add(Box.createVerticalGlue()); } else { File folder = new File(this.folderViewed); File notes = new File(this.notesFile); notesLabel.setText(notes.getAbsolutePath()); notespane.setLayout(new BorderLayout()); notespane.removeAll(); notespane.add(editor); if (notes.exists()) editor.open(notes); fileRepository.setFolder(folder); } notespane.invalidate(); notespane.validate(); this.repaint(); }