mirror of
https://github.com/Noratrieb/mandelbrotGUI.git
synced 2026-01-14 23:35:04 +01:00
Added the mandelbrot calculator
This commit is contained in:
parent
2234919b69
commit
64dc682257
7 changed files with 360 additions and 6 deletions
30
src/ui/Controller.java
Normal file
30
src/ui/Controller.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package ui;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import mandelbrotCalculator.MandelbrotSet;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class Controller {
|
||||
|
||||
public ImageView setPreview;
|
||||
|
||||
int currentFrame;
|
||||
|
||||
public void showImage(ActionEvent actionEvent) throws FileNotFoundException {
|
||||
|
||||
InputStream stream = new FileInputStream("C:\\Users\\nilsh\\IdeaProjects\\testStuff\\sequence/Sequence" + currentFrame + ".png");
|
||||
Image image = new Image(stream);
|
||||
setPreview.setImage(image);
|
||||
currentFrame++;
|
||||
}
|
||||
|
||||
public void startCalculation(ActionEvent actionEvent) {
|
||||
MandelbrotSet m = new MandelbrotSet(2, 1, 3, 1);
|
||||
m.startMandelbrot();
|
||||
}
|
||||
}
|
||||
25
src/ui/Main.java
Normal file
25
src/ui/Main.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package ui;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
|
||||
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
|
||||
primaryStage.setTitle("Mandelbrot");
|
||||
primaryStage.setScene(new Scene(root, 500, 300));
|
||||
primaryStage.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
7
src/ui/sample.css
Normal file
7
src/ui/sample.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.root {
|
||||
-fx-background-color: #AAAABA;
|
||||
}
|
||||
|
||||
.label {
|
||||
-fx-font-size: 25;
|
||||
}
|
||||
17
src/ui/sample.fxml
Normal file
17
src/ui/sample.fxml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<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" />
|
||||
<columnConstraints>
|
||||
<ColumnConstraints />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints />
|
||||
<RowConstraints />
|
||||
</rowConstraints>
|
||||
</GridPane>
|
||||
Loading…
Add table
Add a link
Reference in a new issue