Advertisement
pilgon-sesh60

patch

Jan 11th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1.     public ArrayList<Integer> load() {
  2.         FileReader fr;
  3.         BufferedReader br;
  4.         String line;
  5.         int correct;
  6.         ArrayList<Integer> stats;
  7.        
  8.         try {
  9.             fr = new FileReader("/home/pilgon-sesh60/code/hello/save.tsv");
  10.             br = new BufferedReader(fr);
  11.             current = Integer.parseInt(br.readLine());
  12.            
  13.             stats = new ArrayList<Integer>();
  14.             correct = Integer.parseInt(br.readLine());
  15.             stats.add(size() - correct);
  16.             stats.add(correct);
  17.             stats.add(Integer.parseInt(br.readLine()));
  18.            
  19.             clear();
  20.             while((line = br.readLine()) != null) {
  21.                 add(new Card(string.split("\t")));
  22.             }
  23.         } catch (IOException e) {
  24.             e.printStackTrace();
  25.             System.exit(0);
  26.         }
  27.        
  28.         return stats;
  29.     }
  30.  
  31.         loadMI = new JMenuItem("Load");
  32.         loadMI.addActionListener(new ActionListener( {
  33.             @Override
  34.             public void actionPerformed(ActionEvent arg0) {
  35.                 ArrayList<Intger> stats;
  36.                 stats = deck.load();
  37.                 remaining.set(stats.get(0));
  38.                 correct.set(stats.get(1));
  39.                 wrong.set(stats.get(2));
  40.                 display.setText(deck.getCurrent().front);
  41.                 inputField.setText("");
  42.             }
  43.         }));
  44.         kanjiProgress.add(loadMI);
  45.  
  46.     public void set(int newVal) {
  47.         count = newVal;
  48.         update();
  49.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement