Refreshing chart when a new file is opened
问题 I have to represent data returned from a file chooser to a chart. Everything works fine until I press the button again and choose a different file. The problem is that instead of representing the new dataset, it's adding it to the previous one. I tried the revalidate , repaint and remove methods, but nothing worked (or I didn't know where to put those methods. My code looks like this: JButton theButton = new JButton("Choose the file"); theButton.addActionListener(new ActionListener() { public