fix #17 Muutettu oletusfontti Arialiin
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
This commit is contained in:
@@ -5,15 +5,13 @@ import fi.lpam.gui.elementit.TabPohja;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Spinner;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Font;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
@@ -42,9 +40,6 @@ public class Asetukset extends TabPohja {
|
||||
|
||||
private Spinner<Integer> tekstiFonttiKoko, buttonFonttiKoko, tulostusFonttiKoko, insets;
|
||||
private ComboBox<String> tekstiFontti, buttonFontti;
|
||||
private int minFonttiKoko = 8;
|
||||
private int maxFonttiKoko = 18;
|
||||
private int stepFontti = 1;
|
||||
|
||||
/**
|
||||
* Luo paneelin fonttien asetusten säätämiseen
|
||||
@@ -63,8 +58,10 @@ public class Asetukset extends TabPohja {
|
||||
otsikko.setFont(tekstiFont);
|
||||
root.addRow(row++, otsikko);
|
||||
|
||||
tekstiFonttiKoko = new Spinner<>(minFonttiKoko, maxFonttiKoko, Double.parseDouble(prop.getProperty("tekstiFonttiKoko")), stepFontti);
|
||||
tekstiFonttiKoko.setEditable(true);
|
||||
int minFonttiKoko = 8;
|
||||
int maxFonttiKoko = 18;
|
||||
int stepFontti = 1;
|
||||
tekstiFonttiKoko = new Spinner<>(minFonttiKoko, maxFonttiKoko, Integer.parseInt(prop.getProperty("tekstiFonttiKoko")), stepFontti);
|
||||
tekstiFonttiKoko.valueProperty().addListener((_) -> prop.setProperty("tekstiFonttiKoko", String.valueOf(tekstiFonttiKoko.getValue())));
|
||||
Label tekstinKoko = new Label("Tekstin koko");
|
||||
tekstinKoko.setFont(tekstiFont);
|
||||
@@ -78,7 +75,7 @@ public class Asetukset extends TabPohja {
|
||||
tekstinFontti.setFont(tekstiFont);
|
||||
root.addRow(row++, tekstinFontti, tekstiFontti);
|
||||
|
||||
buttonFonttiKoko = new Spinner<>(minFonttiKoko, maxFonttiKoko, Double.parseDouble(prop.getProperty("buttonFonttiKoko")), stepFontti);
|
||||
buttonFonttiKoko = new Spinner<>(minFonttiKoko, maxFonttiKoko, Integer.parseInt(prop.getProperty("buttonFonttiKoko")), stepFontti);
|
||||
buttonFonttiKoko.valueProperty().addListener((_) -> prop.setProperty("buttonFonttiKoko", String.valueOf(buttonFonttiKoko.getValue())));
|
||||
Label nappiTekstinKoko = new Label("Painikkeiden koko");
|
||||
nappiTekstinKoko.setFont(tekstiFont);
|
||||
@@ -92,13 +89,13 @@ public class Asetukset extends TabPohja {
|
||||
napinFontti.setFont(tekstiFont);
|
||||
root.addRow(row++, napinFontti, buttonFontti);
|
||||
|
||||
tulostusFonttiKoko = new Spinner<>(minFonttiKoko, maxFonttiKoko, Double.parseDouble(prop.getProperty("tulostusFonttiKoko")), stepFontti);
|
||||
tulostusFonttiKoko = new Spinner<>(minFonttiKoko, maxFonttiKoko, Integer.parseInt(prop.getProperty("tulostusFonttiKoko")), stepFontti);
|
||||
tulostusFonttiKoko.valueProperty().addListener((_) -> prop.setProperty("tulostusFonttiKoko", String.valueOf(tulostusFonttiKoko.getValue())));
|
||||
Label tulostusFontinKoko = new Label("Tulostusfontin koko");
|
||||
tulostusFontinKoko.setFont(tekstiFont);
|
||||
root.addRow(row++, tulostusFontinKoko, tulostusFonttiKoko);
|
||||
|
||||
insets = new Spinner<>(0, 10, Double.parseDouble(prop.getProperty("insets")), 1);
|
||||
insets = new Spinner<>(0, 10, Integer.parseInt(prop.getProperty("insets")), 1);
|
||||
insets.valueProperty().addListener((_) -> prop.setProperty("insets", String.valueOf(insets.getValue())));
|
||||
Label insetsi = new Label("Yleinen fyllinki");
|
||||
insetsi.setFont(tekstiFont);
|
||||
@@ -108,6 +105,20 @@ public class Asetukset extends TabPohja {
|
||||
}
|
||||
|
||||
private void palautaOletukset() {
|
||||
//TODO
|
||||
try {
|
||||
Properties defaults = new Properties();
|
||||
defaults.load(Main.class.getClassLoader().getResourceAsStream("defaults.properties"));
|
||||
|
||||
tekstiFonttiKoko.getValueFactory().setValue(Integer.valueOf(defaults.getProperty("tekstiFonttiKoko")));
|
||||
tekstiFontti.getSelectionModel().select(defaults.getProperty("tekstiFontti"));
|
||||
buttonFonttiKoko.getValueFactory().setValue(Integer.valueOf(defaults.getProperty("buttonFonttiKoko")));
|
||||
buttonFontti.getSelectionModel().select(defaults.getProperty("buttonFontti"));
|
||||
tulostusFonttiKoko.getValueFactory().setValue(Integer.valueOf(defaults.getProperty("tulostusFonttiKoko")));
|
||||
insets.getValueFactory().setValue(Integer.valueOf(defaults.getProperty("insets")));
|
||||
}
|
||||
catch (IOException e) {
|
||||
//noinspection CallToPrintStackTrace
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user