#12 ominaisuus valmis

This commit is contained in:
2026-05-11 03:54:34 +03:00
parent c52dbcd716
commit a29fb6d0f5
8 changed files with 71 additions and 7 deletions
@@ -0,0 +1,55 @@
package fi.lpam.gui.elementit;
import fi.lpam.Main;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import one.jpro.platform.mdfx.MarkdownView;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Objects;
public class MuutosIlmoitus extends Stage {
public MuutosIlmoitus() {
super();
VBox root = new VBox();
root.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
root.setPadding(TabPohja.oletusInsets);
root.setStyle(TabPohja.oletusStyle);
root.setAlignment(Pos.CENTER);
root.setSpacing(10);
String md;
try (InputStreamReader isr = new InputStreamReader(Objects.requireNonNull(Main.class.getClassLoader().getResourceAsStream("CHANGELOG.md")))) {
md = isr.readAllAsString();
int toinenMerkintä = md.indexOf("# ", 1);
int kolmasMerkintä = md.indexOf("# ", toinenMerkintä + 1);
int endIndex = md.indexOf("# ", kolmasMerkintä + 1);
md = md.substring(0, endIndex);
}
catch (IOException e) {
e.printStackTrace();
md = "# Virhe versiolokin haussa";
}
MarkdownView markdownView = new MarkdownView(md);
root.getChildren().add(markdownView);
Button ok = new Button("OK");
ok.setFont(TabPohja.buttonFont);
ok.setOnAction(e -> this.close());
root.getChildren().add(ok);
Scene scene = new Scene(root);
this.setScene(scene);
this.setTitle("Uusi versio, katso muutokset alta!");
this.setResizable(false);
this.show();
Main.properties.setProperty("viimeisinVersio", Main.properties.getProperty("version"));
}
}