package com.hammurapi.jdraw; import java.awt.Color; import java.awt.event.ActionEvent; import javax.swing.JApplet; import com.mxgraph.examples.swing.GraphEditor; import com.mxgraph.examples.swing.editor.BasicGraphEditor; import com.mxgraph.examples.swing.editor.EditorActions; import com.mxgraph.examples.swing.editor.EditorMenuBar; import com.mxgraph.swing.util.mxSwingConstants; import com.mxgraph.util.mxConstants; public class JDrawApplet extends JApplet { // private DefaultHttpClient httpClient; @Override public void init() { super.init(); // HttpParams params = new BasicHttpParams(); // SchemeRegistry schemeRegistry = new SchemeRegistry(); // schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); // // ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); // httpClient = new DefaultHttpClient(cm, params); // Proxy configuration - requires java.net.NetPermission getProxySelector // ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner( // httpClient.getConnectionManager().getSchemeRegistry(), // ProxySelector.getDefault()); // httpClient.setRoutePlanner(routePlanner); // HttpHost proxy = new HttpHost("localhost", 8888); // httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } @Override public void start() { mxSwingConstants.SHADOW_COLOR = Color.LIGHT_GRAY; mxConstants.W3C_SHADOWCOLOR = "#D3D3D3"; BasicGraphEditor.Config config = new BasicGraphEditor.Config(this); //, httpClient); GraphEditor editor = new GraphEditor(config); getContentPane().add(editor); setJMenuBar(new EditorMenuBar(editor)); ActionEvent event = new ActionEvent(editor.getGraphComponent(), -1, "open"); new EditorActions.OpenAction().actionPerformed(event); } // @Override // public void destroy() { // if (httpClient!=null) { // httpClient.getConnectionManager().shutdown(); // } // super.destroy(); // } }