@FXML
protected void locateFile(ActionEvent event) throws BiffException, IOException {
ExcelFileNameTextField.clear();
MailList.clear();
ArrayList<String> AlTo = MailInfo.getArrListTo(); //arraylist 값 집어넣기
AlTo.clear();
FileChooser chooser = new FileChooser();
chooser.setTitle("Open File");
File file = chooser.showOpenDialog(new Stage());
Workbook workbook = Workbook.getWorkbook(file);
Sheet sheet = workbook.getSheet(0);
String FullPath = file.getAbsolutePath();
int endIdx = sheet.getColumn(0).length-1;
ObservableList<TableClass> data = FXCollections.observableArrayList(
new TableClass(sheet.getCell(0,0).getContents(),sheet.getCell(1, 0).getContents(),sheet.getCell(2, 0).getContents()),
new TableClass(sheet.getCell(0,1).getContents(),sheet.getCell(1, 1).getContents(),sheet.getCell(2, 1).getContents()),
new TableClass(sheet.getCell(0,2).getContents(),sheet.getCell(1, 2).getContents(),sheet.getCell(2, 2).getContents()),
new TableClass(sheet.getCell(0,3).getContents(),sheet.getCell(1, 3).getContents(),sheet.getCell(2, 3).getContents())
);
for(int i=0; i <= endIdx; i++){
String email = sheet.getCell(0, i).getContents() ;
//String name = sheet.getCell(1, i).getContents() ;
//String company = sheet.getCell(2, i).getContents() ;
NameColumn.setCellValueFactory(new PropertyValueFactory<TableClass,String>("Name"));
MailColumn.setCellValueFactory(new PropertyValueFactory<TableClass,String>("Mail"));
CompanyColumn.setCellValueFactory(new PropertyValueFactory<TableClass,String>("Company"));
Table.setItems(data);
AlTo.add(email);
MailList.appendText(i+1 + " 번 Address = " + email+"\n");
}
workbook.close();
ExcelFileNameTextField.appendText(FullPath);
}
이 소스 보시면 ObservableList를 제가 수동으로써줘야하는데
for문으로
new TableClass(sheet.getCell(0,1).getContents(),sheet.getCell(1, 1).getContents(),sheet.getCell(2, 1).getContents()),
이거를 ObservableList에 한줄한줄 추가할방법이있을까여?
자바고수님들도와주세여