public AboutPanel() { setTitle("About Panel"); ImageIcon img = new ImageIcon("icons/preferences.jpg"); setIconImage(img.getImage()); Container contentPane = getContentPane(); contentPane.setLayout(new MigLayout()); setBackground(Color.GRAY); int style1 = Font.CENTER_BASELINE; Font font = new Font("Arial", style1, 13); about = new JLabel(); about.setFont(font); String key = userPrefs.getRegistrationKey(); if (key == null || key.length() == 0) { userPrefs.setRegistrationKey("Community Edition"); } about.setText("<html>WattzAp Community Edition<br/><br/>Version 2.5.1<br/>19th August 2015"); add(about, "alignx right, span"); debug = new JCheckBox("Enable Debugging"); if (userPrefs.isDebug()) { debug.setSelected(true); } else { debug.setSelected(false); } debug.addActionListener(this); add(debug); Dimension d = new Dimension(550, 300); this.setPreferredSize(d); pack(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
public static void main(String[] args) { // Debug Level level = setLogLevel(); // hard coded for debugging, not important, normally libvlc is found on // lib path NativeLibrary.addSearchPath("libvlc", "."); // configure the appender String PATTERN = "%r [%t] %p %c %x %m%n"; String logFile = userPrefs.getWD() + "/logfile.txt"; FileAppender fileAppender; try { fileAppender = new FileAppender(new PatternLayout(PATTERN), logFile); fileAppender.setThreshold(level); fileAppender.activateOptions(); // add appender to any Logger (here is root) Logger.getRootLogger().addAppender(fileAppender); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // create appender // Turn on Debug window if (userPrefs.isDebug()) { SwingAppender appender = new SwingAppender(); // create appender // configure the appender appender.setLayout(new PatternLayout(PATTERN)); appender.setThreshold(level); appender.activateOptions(); // add appender to any Logger (here is root) Logger.getRootLogger().addAppender(appender); } logger.info("Setting log level => " + level.toString()); logger.info("Database Version " + userPrefs.getDBVersion()); try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } EventQueue.invokeLater(new Main()); } catch (Exception e) { // catch everything and log logger.error(e.getLocalizedMessage()); userPrefs.shutDown(); } }