I am creating a program which reads a CSV file (article numbers) and searches web pages (e.g. asdfjh.com/12547.hmtl, asdfjh.com/12548.hmtl, asdfjh.com/12549.hmtl, asdfjh.com/12550.hmtl).
The purpose is to grab the eans
on the sites and add them to the CSV-file. I'm having a problem that I don't understand.
Code:
package beginnDesignUndFunktion.code;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ProgressBar;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import java.io.File;
import java.io.IOException;
public class DesignController {
static File file;
@FXML
ProgressBar progressBar = new ProgressBar();
@FXML
protected void handleButtonAction(ActionEvent event) {
FileChooser chooser = new FileChooser();
chooser.setTitle("Open File");
file = chooser.showOpenDialog(new Stage());
System.out.println(file.toString());
try {
int anzahl = CsvVerabeitung.countLines(file.toString());
System.out.println(anzahl + " Dateien");
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML
protected void handleSubmitButtonAction(ActionEvent event) {
String path = file.toString();
Reader.read(path);
Writer.write();
}
@FXML
protected static void setProgress(int y){
int anzahl = 0;
try {
anzahl = CsvVerabeitung.countLines(file.toString());
} catch (IOException e) {
e.printStackTrace();
}
double progress = ((double) y) / ((double) anzahl);
System.out.println(progress);
progressBar.setProgress(progress);
}
}
The communication with other classes works. What am I doing wrong?