Preview is now shown

This commit is contained in:
nora 2020-11-18 19:17:15 +01:00
parent eb71992b08
commit 97d87fb1ba
5 changed files with 58 additions and 15 deletions

View file

@ -4,6 +4,7 @@ import javafx.event.ActionEvent;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import mandelbrotCalculator.MandelbrotSet;
import util.Values;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -13,18 +14,15 @@ public class Controller {
public ImageView setPreview;
int currentFrame;
public void nextImage(int frameNumber) throws FileNotFoundException {
public void showImage(ActionEvent actionEvent) throws FileNotFoundException {
InputStream stream = new FileInputStream("C:\\Users\\nilsh\\IdeaProjects\\testStuff\\sequence/Sequence" + currentFrame + ".png");
InputStream stream = new FileInputStream(Values.SAVE_IMAGE_PATH + frameNumber + ".png");
Image image = new Image(stream);
setPreview.setImage(image);
currentFrame++;
}
public void startCalculation(ActionEvent actionEvent) {
MandelbrotSet m = new MandelbrotSet(2, 2, 3, 10);
MandelbrotSet m = new MandelbrotSet(2, 1, 3, 100, this);
m.startMandelbrot();
}
}

View file

@ -6,7 +6,7 @@
<GridPane alignment="center" hgap="10.0" prefHeight="143.0" prefWidth="107.0" stylesheets="/ui/sample.css" vgap="10" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ui.Controller">
<Button onAction="#startCalculation" prefHeight="25.0" prefWidth="110.0" text="Start" GridPane.rowIndex="1" />
<ImageView fx:id="setPreview" fitWidth="100" preserveRatio="true" />
<ImageView fx:id="setPreview" fitWidth="500" preserveRatio="true" />
<columnConstraints>
<ColumnConstraints />
</columnConstraints>