Examples of Applet


Examples of java.applet.Applet

    public static void startApplet(String className,
                                   String title,
                                   String args[])
    {
       // local variables
       Applet a;
       Dimension appletSize;

       try
       {
          // create an instance of your applet class
          a = (Applet) Class.forName(className).newInstance();
       }
       catch (ClassNotFoundException e) { return; }
       catch (InstantiationException e) { return; }
       catch (IllegalAccessException e) { return; }

       // initialize the applet
       a.init();
       a.start();
 
       // create new application frame window
       AppletFrame f = new AppletFrame(title);
 
       // add applet to frame window
       f.add("Center", a);
 
       // resize frame window to fit applet
       // assumes that the applet sets its own size
       // otherwise, you should set a specific size here.
       appletSize =  a.getSize();
       f.pack();
       f.setSize(appletSize)

       // show the window
       f.show();
View Full Code Here

Examples of java.applet.Applet

                if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
                    focusLog.finer("default component is " + toFocus);
                }
            }
            if (toFocus == null) {
                Applet applet = EmbeddedFrame.getAppletIfAncestorOf(this);
                if (applet != null) {
                    toFocus = applet;
                }
            }
            candidate = toFocus;
View Full Code Here

Examples of java.applet.Applet

            Component toFocus = policy.getComponentAfter(rootAncestor, comp);
            if (toFocus == null) {
                toFocus = policy.getDefaultComponent(rootAncestor);
            }
            if (toFocus == null) {
                Applet applet = EmbeddedFrame.getAppletIfAncestorOf(this);
                if (applet != null) {
                    toFocus = applet;
                }
            }
      return toFocus;
View Full Code Here

Examples of java.applet.Applet

    {
  String[] props = VersionHelper.PROPS;  // system/applet properties
  if (env == null) {
      env = new Hashtable(11);
  }
  Applet applet = (Applet)env.get(Context.APPLET);

  // Merge property values from env param, applet params, and system
  // properties.  The first value wins:  there's no concatenation of
  // colon-separated lists.
  // Read system properties by first trying System.getProperties(),
  // and then trying System.getProperty() if that fails.  The former
  // is more efficient due to fewer permission checks.
  //
  String[] jndiSysProps = helper.getJndiProperties();
  for (int i = 0; i < props.length; i++) {
      Object val = env.get(props[i]);
      if (val == null) {
    if (applet != null) {
        val = applet.getParameter(props[i]);
    }
    if (val == null) {
        // Read system property.
        val = (jndiSysProps != null)
      ? jndiSysProps[i]
View Full Code Here

Examples of java.applet.Applet

        String icon = getIconName(comp);
        if (icon != null)
            setAttribute(TAG_ICON, icon);

        if (comp instanceof Applet) {
            Applet applet = (Applet)comp;
            setAttribute(TAG_PARAMS, encodeParams(applet));
            java.net.URL url = applet.getDocumentBase();
            setAttribute(TAG_DOCBASE, url != null
                         ? url.toString() : "null");
        }

        Container parent = resolver.getHierarchy().getParent(comp);
View Full Code Here

Examples of java.applet.Applet

            // Don't subtract for index mismatch, since ordering changes are
            // common.
        }

        if (comp instanceof Applet) {
            Applet applet = (Applet)comp;
            String params = getAttribute(TAG_PARAMS);
            if (null != params) {
                String params2 = encodeParams(applet);
                if (expressionMatch(params, params2))
                    weight += MW_PARAMS;
            }
            String docBase = getAttribute(TAG_DOCBASE);
            if (null != docBase) {
                java.net.URL url = applet.getDocumentBase();
                if (url != null && expressionMatch(docBase, url.toString()))
                    weight += MW_DOCBASE;
            }
            // No negative weighting here
        }
View Full Code Here

Examples of java.applet.Applet

        }
    }

    // Regression for HARMONY-3777
    public void test_instantiate_with_applet() throws Exception {
        Applet applet = (Applet) Beans.instantiate(null, "java.applet.Applet");
        assertNotNull(applet.getAppletContext());
        assertTrue(applet.isActive());
    }
View Full Code Here

Examples of java.applet.Applet

  /** Opens the specified URL (default is the ImageJ home page). */
  public void run(String theURL) {
    if (error) return;
    if (theURL==null || theURL.equals(""))
      theURL = "http://rsb.info.nih.gov/ij/";
    Applet applet = IJ.getApplet();
    if (applet!=null) {
      try {
        applet.getAppletContext().showDocument(new URL(theURL), "_blank" );
      } catch (Exception e) {}
      return;
    }
    try {openURL(theURL);}
    catch (IOException e) {}
View Full Code Here

Examples of java.applet.Applet

    }
  }
 
  // Plugins>Macros>Open Startup Macros command
  void openStartupMacros() {
    Applet applet = IJ.getApplet();
    if (applet!=null) {
      IJ.run("URL...", "url=http://rsb.info.nih.gov/ij/applet/StartupMacros.txt");
    } else {
      String path = IJ.getDirectory("macros")+"/StartupMacros.txt";
      File f = new File(path);
View Full Code Here

Examples of java.applet.Applet

      else
        str2 = "<lf>";
    }
    sb.append("  line.separator: " + str1 + str2+"\n");
     
    Applet applet = IJ.getApplet();
    if (applet!=null) {
      sb.append("\n");
      sb.append("  code base: "+applet.getCodeBase()+"\n");
      sb.append("  document base: "+applet.getDocumentBase()+"\n");
      sb.append("  sample images dir: "+Prefs.getImagesURL()+"\n");
      TextWindow tw = new TextWindow("Properties", new String(sb), 400, 400);
      return;
    }
    sb.append("\n");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.