private void loadTopicsFromFile() throws IOException { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("ExtempFiller2"); chooser.setFileFilter( new FileFilter() { @Override public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith(".txt"); } @Override public String getDescription() { return "Text Files"; } }); int response = chooser.showOpenDialog(this); if (response == JFileChooser.APPROVE_OPTION) { // get everything currently researched java.util.List<String> researched = managerPanel.getTopics(); // load everything from file File file = chooser.getSelectedFile(); Scanner readScanner = new Scanner(file); while (readScanner.hasNext()) { String topic = readScanner.nextLine(); if (!researched.contains(topic)) { Topic t = new Topic(topic); managerPanel.addTopic(t); inQueue.add(new InMessage(InMessage.Type.RESEARCH, t)); } } } }
public void setTopics(java.util.List<Topic> topics) { managerPanel.setResearchedTopics(topics); }
public void removeTopic(Topic topic) { managerPanel.removeTopic(topic); }
public void setTopicState(Topic topic, TopicState state) { managerPanel.setTopicState(topic, state); }
public void setEnabled(boolean value) { managerPanel.setEnabled(value); }