Package java.applet

Examples of java.applet.Applet$URLAudioClip


                if (focusLog.isLoggable(PlatformLogger.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


        public void windowClosing(WindowEvent e) {
            JFrame frame = (JFrame)e.getWindow();
            frameList.remove(frame);

            Applet applet = ((AppletFrame)frame).getApplet();
            if(applet != null){
                ViewerAppletContext ac =
                    (ViewerAppletContext)applet.getAppletContext();
                ac.remove(applet);
            }

            if (frameList.isEmpty())
                System.exit(0);
View Full Code Here

      rows = 4;
      cols = 4;
      scale = WALL_SCALE / Math.max(rows, cols);
      for (int row = 1; row <= rows; row++)
    for (int col = 1; col <= cols; col++) {
        Applet applet = createInstance(name, row, col);
        makeFrameForApplet(applet, row, col, scale);
    }
  } else {
      rows = Integer.valueOf(args[1]);
      cols = Integer.valueOf(args[2]);
      int row = Integer.valueOf(args[3]);
      int col = Integer.valueOf(args[4]);
      if (args.length == 6)
    scale = Float.valueOf(args[5]);
      else
    scale = 1.0f;
      Applet applet = createInstance(name, row, col);
      makeFrameForApplet(applet, row, col, scale);
  }
    }
View Full Code Here

  public LoginForm getLoginForm() {
    return loginForm;
  }

  public int runGame(String user, String session, String downloadTicket, String mcpass) {
    Applet applet = null;
    try {
      applet = Launcher.getMinecraftApplet();
    } catch (CorruptedMinecraftJarException corruption) {
      corruption.printStackTrace();
    } catch (MinecraftVerifyException verify) {
      OptionDialog.clearCache();
      JOptionPane.showMessageDialog(getParent(), "The minecraft installation was corrupted. \nThe minecraft installation has been cleaned. \nTry to login again. If that fails, close and \nrestart the appplication.");
      this.setVisible(false);
      this.dispose();
      return ERROR_IN_LAUNCH;
    }
    if (applet == null) {
      String message = "Failed to launch Launcher!";
      this.setVisible(false);
      JOptionPane.showMessageDialog(getParent(), message);
      this.dispose();
      return ERROR_IN_LAUNCH;
    }

    minecraft = new MinecraftAppletEnglober(applet);

    String launcherPath = String.format("%s/%s", PlatformUtils.LAUNCHER_DIR, ModPackListYML.currentModPack);

    minecraft.addParameter("username", user);
    minecraft.addParameter("sessionid", session);
    minecraft.addParameter("downloadticket", downloadTicket);
    minecraft.addParameter("mppass", mcpass);
    minecraft.addParameter("spoutcraftlauncher", "true");
    minecraft.addParameter("stand-alone", String.valueOf(MinecraftUtils.getOptions().isPortable()));
    minecraft.addParameter("portable", String.valueOf(MinecraftUtils.getOptions().isPortable()));
    minecraft.addParameter("directory", launcherPath);
    Util.log("Loading Launcher from '%s'", launcherPath);
    if (MinecraftUtils.getOptions().getServer() != null) {
      minecraft.addParameter("server", MinecraftUtils.getOptions().getServer());
      if (MinecraftUtils.getOptions().getPort() != null) {
        minecraft.addParameter("port", MinecraftUtils.getOptions().getPort());
      }
    }

    applet.setStub(minecraft);

    this.add(minecraft);
    validate();

    minecraft.init();
View Full Code Here



public class AppletFrame {
  public static void main(String[] args) {
    Applet Pacman = new Applet(); // define applet of interest
    Frame myFrame = new Frame("Contenitore di Luigi Usai per Applet"); // create frame with title
    // Call applet's init method (since Java App does not
    // call it as a browser automatically does)
    Pacman.init();
   
  
   
   
    // avvio il gioco
    Pacman.setVisible(true);
    Pacman.init();
   
   
   
    // add applet to the frame
    myFrame.add(Pacman, BorderLayout.CENTER);
View Full Code Here

    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.setVisible(true);
View Full Code Here

            // Ok, if the result is an applet initialize it.

            AppletStub stub = null;

            if (result instanceof Applet) {
                Applet  applet      = (Applet) result;
                boolean needDummies = initializer == null;

                if (needDummies) {

                    // Figure our the codebase and docbase URLs.  We do this
                    // by locating the URL for a known resource, and then
                    // massaging the URL.

                    // First find the "resource name" corresponding to the bean
                    // itself.  So a serialzied bean "a.b.c" would imply a
                    // resource name of "a/b/c.ser" and a classname of "x.y"
                    // would imply a resource name of "x/y.class".

                    final String resourceName;

                    if (serialized) {
                        // Serialized bean
                        resourceName = beanName.replace('.','/').concat(".ser");
                    } else {
                        // Regular class
                        resourceName = beanName.replace('.','/').concat(".class");
                    }

                    URL objectUrl = null;
                    URL codeBase  = null;
                    URL docBase   = null;

                    // Now get the URL correponding to the resource name.

                    final ClassLoader cloader = cls;
                    objectUrl = (URL)
                        AccessController.doPrivileged
                        (new PrivilegedAction() {
                            public Object run() {
                                if (cloader == null)
                                    return ClassLoader.getSystemResource
                                                                (resourceName);
                                else
                                    return cloader.getResource(resourceName);
                            }
                    });

                    // If we found a URL, we try to locate the docbase by taking
                    // of the final path name component, and the code base by taking
                    // of the complete resourceName.
                    // So if we had a resourceName of "a/b/c.class" and we got an
                    // objectURL of "file://bert/classes/a/b/c.class" then we would
                    // want to set the codebase to "file://bert/classes/" and the
                    // docbase to "file://bert/classes/a/b/"

                    if (objectUrl != null) {
                        String s = objectUrl.toExternalForm();

                        if (s.endsWith(resourceName)) {
                            int ix   = s.length() - resourceName.length();
                            codeBase = new URL(s.substring(0,ix));
                            docBase  = codeBase;

                            ix = s.lastIndexOf('/');

                            if (ix >= 0) {
                                docBase = new URL(s.substring(0,ix+1));
                            }
                        }
                    }

                    // Setup a default context and stub.
                    BeansAppletContext context = new BeansAppletContext(applet);

                    stub = (AppletStub)new BeansAppletStub(applet, context, codeBase, docBase);
                    applet.setStub(stub);
                } else {
                    initializer.initialize(applet, beanContext);
                }

                // now, if there is a BeanContext, add the bean, if applicable.

                if (beanContext != null) {
                    beanContext.add(result);
                }

                // If it was deserialized then it was already init-ed.
                // Otherwise we need to initialize it.

                if (!serialized) {
                    // We need to set a reasonable initial size, as many
                    // applets are unhappy if they are started without
                    // having been explicitly sized.
                    applet.setSize(100,100);
                    applet.init();
                }

                if (needDummies) {
                  ((BeansAppletStub)stub).active = true;
                } else initializer.activate(applet);
View Full Code Here

         if (label.equals ("Disconnect"))
            {
            Enumeration e = getAppletContext ().getApplets ();
            while (e.hasMoreElements ())
               {
               Applet app = (Applet) e.nextElement ();
               if (app instanceof BailInOut)
                  ((BailInOut)app).bailout ();
               }
            return (true);
            }
View Full Code Here

                mc.getMethod("main", String[].class).invoke(null, (Object) mcArgs);
            } else {
                System.out.println("Launching with applet wrapper...");
                try {
                    Class<?> MCAppletClass = cl.loadClass("net.minecraft.client.MinecraftApplet");
                    Applet mcappl = (Applet) MCAppletClass.newInstance();
                    MCFrame mcWindow = new MCFrame("ATLauncher - " + instanceName);
                    mcWindow.start(mcappl, username, session, winSize, maximize);
                } catch (InstantiationException e) {
                    System.out.println("Applet wrapper failed! Falling back " + "to compatibility mode.");
                    mc.getMethod("main", String[].class).invoke(null, (Object) mcArgs);
View Full Code Here

    if(archiveUrl == null) {
      throw new IllegalArgumentException("No applet url!");
    }
    try {
      URLClassLoader classLoader = new URLClassLoader(new URL[] {archiveUrl});
      Applet app = (Applet) classLoader.loadClass(className).newInstance();
      app.setStub(new WebAppletStub(app, baseUrl, params));
      app.setVisible(true);
      app.init();
      app.start();
      return app;
    } catch(Exception e) {
      throw new AppletLoaderException(e);
    }
  }
View Full Code Here

TOP

Related Classes of java.applet.Applet$URLAudioClip

Copyright © 2018 www.massapicom. 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.