Java tutorial
/* * Copyright (C) 2013 Edouard Murat. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ package com.eddy.malupdater; import com.eddy.malupdater.credentials.CredentialsPanel; import java.io.IOException; import java.util.logging.FileHandler; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import org.apache.commons.lang.StringUtils; /** * * @author eddy */ public class MalUpdater { private static MalUpdaterForm form; public static void main(String args[]) { try { initMainLogger(); UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(MalUpdater.class.getName()).log(Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { form = new MalUpdaterForm(); if (StringUtils.isEmpty(MyProperties.getUsername()) || MyProperties.getPassword().length <= 0) { CredentialsPanel credentialsPanel = CredentialsPanel.getInstance(); credentialsPanel.setVisible(true); } } }); } public static void initMainLogger() throws IOException { Handler handler = new FileHandler("error.log", 8096, 1); Logger.getLogger("com.eddy.malupdater").addHandler(handler); } public static void exit() { System.exit(0); } }