1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.draw9patch; 18 19 import com.android.draw9patch.ui.MainFrame; 20 21 import javax.swing.SwingUtilities; 22 import javax.swing.UIManager; 23 import javax.swing.UnsupportedLookAndFeelException; 24 25 public class Application { initUserInterface()26 private static void initUserInterface() { 27 System.setProperty("apple.laf.useScreenMenuBar", "true"); 28 System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Draw 9-patch"); 29 30 try { 31 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 32 } catch (ClassNotFoundException e) { 33 e.printStackTrace(); 34 } catch (InstantiationException e) { 35 e.printStackTrace(); 36 } catch (IllegalAccessException e) { 37 e.printStackTrace(); 38 } catch (UnsupportedLookAndFeelException e) { 39 e.printStackTrace(); 40 } 41 } 42 main(final String... args)43 public static void main(final String... args) { 44 initUserInterface(); 45 SwingUtilities.invokeLater(new Runnable() { 46 public void run() { 47 String arg = args.length > 0 ? args[0] : null; 48 MainFrame frame = new MainFrame(arg); 49 frame.setDefaultCloseOperation(MainFrame.EXIT_ON_CLOSE); 50 frame.setLocationRelativeTo(null); 51 frame.setVisible(true); 52 } 53 }); 54 } 55 } 56