package controllers; import javafx.embed.swing.SwingFXUtils; import javafx.fxml.FXML; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.stage.FileChooser; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; /** * Created by Gondr on 1/06/2017. */ public class UploadPhotoController extends Controller { private Image photoStored; private int studentNumber; private String email; private String password; private String address; private String homephone; private String mobilephone; private String accountType; @FXML private ImageView photo; public void setUserInformation(int studentNumber, String email, String password, String address, String homephone, String mobilephone, String accountType){ this.studentNumber = studentNumber; this.email = email; this.password = password; this.address = address; this.homephone = homephone; this.mobilephone = mobilephone; this.accountType = accountType; } public void upload(){ FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Select a Picture for you Profile."); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif")); File file = fileChooser.showOpenDialog(parent.getPrimaryStage()); if (file != null){ try { BufferedImage bufferedImage = ImageIO.read(file); photoStored = SwingFXUtils.toFXImage(bufferedImage, null); photo.setImage(photoStored); } catch (IOException e) { } } } public void next(){ } @Override public void initialize(URL location, ResourceBundle resources) { } }