1 14 package org.compiere.apps; 15 16 import java.awt.*; 17 import java.awt.event.*; 18 import java.applet.*; 19 import javax.swing.*; 20 21 27 public final class AStart extends JApplet 28 { 29 boolean isStandalone = false; 30 31 34 public String getParameter(String key, String def) 35 { 36 return isStandalone ? System.getProperty(key, def) : 37 (getParameter(key) != null ? getParameter(key) : def); 38 } 39 40 43 public AStart() 44 { 45 } 46 47 50 public void init() 51 { 52 try 53 { 54 jbInit(); 55 } 56 catch(Exception e) 57 { 58 e.printStackTrace(); 59 } 60 } 61 62 65 private void jbInit() throws Exception 66 { 67 this.setSize(new Dimension(400,300)); 68 } 69 70 73 public void start() 74 { 75 } 76 77 80 public void stop() 81 { 82 } 83 84 87 public void destroy() 88 { 89 } 90 91 94 public String getAppletInfo() 95 { 96 return "Start Applet"; 97 } 98 99 102 public String [][] getParameterInfo() 103 { 104 return null; 105 } 106 107 110 public static void main(String [] args) 111 { 112 AStart applet = new AStart(); 113 applet.isStandalone = true; 114 JFrame frame = new JFrame(); 115 frame.setDefaultCloseOperation(3); 117 frame.setTitle("Start Applet"); 118 frame.getContentPane().add(applet, BorderLayout.CENTER); 119 applet.init(); 120 applet.start(); 121 frame.setSize(400,320); 122 Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 123 frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2); 124 frame.setVisible(true); 125 } 126 127 static 129 { 130 try 131 { 132 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 133 } 135 catch(Exception e) 136 { 137 } 138 } 139 } | Popular Tags |