Ignore:
Timestamp:
2007-10-26T21:58:25+02:00 (17 years ago)
Author:
gebner
Message:

Make the applet code work again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplet.java

    r298 r431  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.applet.AppletStub;
     7import java.applet.AppletContext;
    68import java.awt.GridBagLayout;
    79import java.awt.event.ActionEvent;
    810import java.awt.event.KeyEvent;
     11import java.io.File;
     12import java.net.URL;
    913import java.util.Arrays;
    1014import java.util.Collection;
     
    1418
    1519import javax.swing.JApplet;
     20import javax.swing.JFrame;
    1621import javax.swing.JLabel;
    1722import javax.swing.JOptionPane;
     
    5560
    5661        private Map<String, Collection<String>> args = new HashMap<String, Collection<String>>();
    57         private UploadPreferencesAction uploadPreferences = new UploadPreferencesAction();
    5862
    5963        @Override public String[][] getParameterInfo() {
     
    101105                // remove offending stuff from JOSM (that would break the SecurityManager)
    102106                m.remove(m.fileMenu);
    103                 m.editMenu.add(uploadPreferences);
     107                m.editMenu.add(new UploadPreferencesAction());
    104108                m.open.setEnabled(false);
    105109                m.exit.setEnabled(false);
     
    118122                return v;
    119123        }
     124
     125        public static void main(String[] args) {
     126                final JFrame frame = new JFrame("Java OpenStreetMap Applet");
     127                MainApplet applet = new MainApplet();
     128                applet.setStub(new AppletStub() {
     129                        public void appletResize(int w, int h) {
     130                                frame.resize(w, h);
     131                        }
     132
     133                        public AppletContext getAppletContext() {
     134                                return null;
     135                        }
     136
     137                        public URL getCodeBase() {
     138                                try {
     139                                        return new File(".").toURI().toURL();
     140                                } catch (Exception e) {
     141                                        e.printStackTrace();
     142                                        return null;
     143                                }
     144                        }
     145
     146                        public URL getDocumentBase() {
     147                                return getCodeBase();
     148                        }
     149
     150                        public String getParameter(String k) {
     151                                return null;
     152                        }
     153
     154                        public boolean isActive() {
     155                                return true;
     156                        }
     157                });
     158                applet.init();
     159                applet.start();
     160                frame.setContentPane(applet);
     161                frame.setVisible(true);
     162        }
    120163}
Note: See TracChangeset for help on using the changeset viewer.