/*******************************************************************************
* DialogueEditor
* Copyright (C) 2013-2014 Pawel Pastuszak
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package pl.kotcrab.jdialogue.editor;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import java.awt.EventQueue;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
public class Main {
/**
* Launch the application.
*/
public static void main (String[] args) {
App.parseArguments(args);
try {
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
public void run () {
Editor window = new Editor();
Editor.window = window;
window.setVisible(true);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gd = ge.getScreenDevices();
if (App.getScreenId() > -1 && App.getScreenId() < gd.length) {
window.setLocation(gd[App.getScreenId()].getDefaultConfiguration().getBounds().x, window.getY());
} else if (gd.length > 0) {
window.setLocation(gd[0].getDefaultConfiguration().getBounds().x, window.getY());
} else //really somebody can launch this with no screen?
{
throw new RuntimeException("No Screens Found - Get a screen");
}
window.setExtendedState(window.getExtendedState() | JFrame.MAXIMIZED_BOTH);
if (App.getProjectFile() != null) window.loadProject(App.getProjectFile());
}
});
}
}