Skip to content

Commit

Permalink
GUI und Main
Browse files Browse the repository at this point in the history
GUI
+ Angepasst an die neue Variable Main.configPath
+ DeadCode entfernt

Main
+ Dateispeicherort der Config umbenannt ud nicht mehr final
  • Loading branch information
adiko01 committed Apr 25, 2023
1 parent 5e407ac commit 58437d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions Eieruhr/src/de/adiko01/eieruhr/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Timer;
import java.util.TimerTask;
Expand Down Expand Up @@ -225,7 +223,6 @@ public void actionPerformed(ActionEvent e) {
mn_AlarmSound.add(radio_AlarmOFF);

radio_AnalogAlarmClock = new JRadioButtonMenuItem("Analog Alarm Clock by bone666138");
radio_AnalogAlarmClock.setSelected(true); //TODO Hole dies aus der Config
radio_AnalogAlarmClock.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Main.MyConfig.setAlarmSoundFile("audio/198841__bone666138__analog-alarm-clock.wav");
Expand Down Expand Up @@ -501,7 +498,7 @@ public void updatePanelForSettings () {

//Speichere die Änderrung
try {
ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(Main.CONFIG_PATH));
ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(Main.configPath));
stream.writeObject(Main.MyConfig);
stream.close();
} catch (IOException ioex) {
Expand Down
7 changes: 5 additions & 2 deletions Eieruhr/src/de/adiko01/eieruhr/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ public class Main {
/** Config */
public static Config MyConfig;

public final static String CONFIG_PATH = "C:/Users/Admin/Desktop/test.txt";
public static String configPath = "C:/Users/Admin/Desktop/test.txt";

/** Start Methode
* @param args Diverse Start Parameter siehe Programmaufruf mit {@code help}
*/
public static void main(String[] args) {
//Prüfe OS


if (args.length>0) {
if (args[0].equalsIgnoreCase("help") || args[0].equals("?")) {
System.out.print(Config.VERSION + " in der Version " + Config.VERSION + "\n"
Expand All @@ -31,7 +34,7 @@ public static void main(String[] args) {
} else {
//Versuche die Configuration zu laden
try {
ObjectInputStream stream = new ObjectInputStream(new FileInputStream(CONFIG_PATH));
ObjectInputStream stream = new ObjectInputStream(new FileInputStream(configPath));
Config nConf = (Config) stream.readObject();
stream.close();
Main.MyConfig = nConf;
Expand Down

0 comments on commit 58437d4

Please sign in to comment.