108 lines
3.6 KiB
Java
Executable File
108 lines
3.6 KiB
Java
Executable File
package audiobook;
|
|
|
|
//~--- non-JDK imports --------------------------------------------------------
|
|
|
|
/*
|
|
* To change this template, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
import Applications.Application;
|
|
|
|
import java.awt.Desktop;
|
|
import java.awt.event.MouseAdapter;
|
|
import java.awt.event.MouseEvent;
|
|
import java.net.URISyntaxException;
|
|
import swing.LAF.LAF;
|
|
|
|
//~--- JDK imports ------------------------------------------------------------
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
import java.net.URI;
|
|
import javax.swing.ImageIcon;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JOptionPane;
|
|
|
|
/**
|
|
*
|
|
* @author Kim
|
|
*/
|
|
public class Main extends Applications.Application {
|
|
|
|
/** The book which is currently edited */
|
|
public static Book currBook;
|
|
|
|
/** Variable used as default directory in JFileChooser. Represents the last selected directory. */
|
|
public static File lastDir;
|
|
|
|
/** An Object representing the non-static methods of this class */
|
|
public static Main mainObj;
|
|
|
|
/** An Instance of {@link MainWindow} which provides methods to create an audiobook */
|
|
public static MainWindow window;
|
|
|
|
/**
|
|
* Main method called on start
|
|
*/
|
|
public static void main(String[] args) {
|
|
mainObj = new Main();
|
|
lastDir = new File(System.getProperty("user.home"));
|
|
LAF.setLAF(LAF.SystemLAF);
|
|
mainObj.createAboutBox(new ImageIcon(Main.class.getResource("audiobook.png")).getImage(),
|
|
new String[] { "Version",
|
|
"Autor" }, new String[] { "2.8 Beta", "Kim" });
|
|
|
|
if (!System.getProperty("os.name").startsWith("Windows")) {
|
|
if (JOptionPane.showConfirmDialog(
|
|
null,
|
|
"Dieses Programm ist nur auf Windows Betriebssystemen vollständig nutzbar und wurde nicht auf anderen Systemen getestet.\n\n Möchten Sie das Programm beenden?",
|
|
"Warnung", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
|
|
System.exit(1);
|
|
}
|
|
}
|
|
|
|
if (!(Float.parseFloat(System.getProperty("java.specification.version")) >= 1.7)) {
|
|
JOptionPane.showMessageDialog(null,
|
|
"Dieses Programm benötigt Java Version 1.7 oder höher.\nBitte Laden Sie die Version von oracle.com",
|
|
"Fehler", JOptionPane.WARNING_MESSAGE);
|
|
try {
|
|
Desktop.getDesktop().browse(new URI("http://www.oracle.com/technetwork/java/javase/downloads/java-se-jre-7-download-432155.html"));
|
|
} catch (URISyntaxException | IOException ex) {
|
|
ex.printStackTrace();
|
|
}
|
|
System.exit(1);
|
|
}
|
|
|
|
currBook = new Book();
|
|
window = new MainWindow();
|
|
window.setLocation(Application.getScreenCenterFor(window));
|
|
window.setVisible(true);
|
|
}
|
|
|
|
@Override
|
|
public String getInfo() {
|
|
return "Ein Programm zum Erstellen von iTunes Hörbüchern";
|
|
}
|
|
|
|
public String getName() {
|
|
return "Audiobook Maker";
|
|
}
|
|
|
|
public void exit() {
|
|
int result = JOptionPane.showConfirmDialog(null,
|
|
"Achtung: Die Eingaben werden nicht gespeichert. Vorher noch eine POD Datei erstellen?",
|
|
"Beenden?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
|
|
|
|
if (result == JOptionPane.NO_OPTION) {
|
|
super.exit();
|
|
} else if (result == JOptionPane.YES_OPTION) {
|
|
window.createPODFile();
|
|
super.exit();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//~ Formatted by Jindent --- http://www.jindent.com
|