Package ejmf.toolkit.util

Examples of ejmf.toolkit.util.StateWaiter


        player = playerpanel.getPlayer();

        // Add ourselves as a listener to the player's events
        player.addControllerListener(this);

  StateWaiter waiter = new StateWaiter(player);

        if (!waiter.blockingRealize()) {
      System.err.println("Can't realize Player");
      return;
  }

  scp = new StandardControlPanel(player);

  Runnable r = new Runnable() {
      public void run() {
          playerpanel.addControlComponent(scp);

          playerpanel.addVisualComponent();
    redraw();
      }
        };

  SwingUtilities.invokeLater(r);
  if (!waiter.blockingPrefetch()) {
      System.err.println("Can't prefetch Player");
      return;
  }
  player.start();
    }
View Full Code Here


        //  Create a Vector of Players
        for(int i = 0; i < args.length; i++) {
            try {
                Player p = Manager.createPlayer(
                    Utility.appArgToMediaLocator(args[i]) );
                new StateWaiter(p).blockingRealize();
                v.addElement(p);
            } catch(Exception e) {
                System.out.println( "Could not create Player for " + args[i]);
            }
        }
View Full Code Here

   
    public void begin() {
  playerpanel = getPlayerPanel();
        player = playerpanel.getPlayer();

  StateWaiter waiter = new StateWaiter(player);

        waiter.blockingRealize();

        Runnable r = new Runnable() {
            public void run() {
                playerpanel.addControlComponent(
      new EjmfControlPanel(player));

                playerpanel.addVisualComponent();
                redraw();
            }
        };
  try {
      // invokeLater is insufficient here. The construction
      // of EjmfControlPanel takes long enough that Player
      // can start before construction completes. The effect
      // of this is that application behaves as if blockingPrefetch
      // was never called. Additionally, it hoses working of
      // EjmfControlPanel is inexplicable ways.

            SwingUtilities.invokeAndWait(r);
  } catch (InterruptedException ie) {
      ie.printStackTrace();
  } catch (InvocationTargetException te) {
      te.printStackTrace();
  }
  waiter.blockingPrefetch();

        // Start Player
  player.start();
    }
View Full Code Here

  if (state == Controller.Started) {
      player.stop();
  }

  if (state < Controller.Prefetched) {
      StateWaiter sw = new StateWaiter(player);
            return sw.blockingPrefetch();
  }
  return true;
    }
View Full Code Here

        } else {
            System.out.println( player.getClass().getName() );
        }

        if( player != null ) {
            new StateWaiter(player).blockingRealize();
            Frame f = new Frame();
            f.add( player.getVisualComponent() );
            f.pack();
            f.setVisible(true);
            player.start();
View Full Code Here

     *                 URL naming a media source
     */
    public void begin() {
        playerpanel = getPlayerPanel();
        player = playerpanel.getPlayer();
  StateWaiter waiter = new StateWaiter(player);

        // Add ourselves as a listener to the player's events
        player.addControllerListener(this);

        // Wait for the Player to realize, then add the components
        if (!waiter.blockingRealize()) {
      System.err.println("Can't realize Player");
      return;
  }

  Runnable r = new Runnable() {
      public void run() {

          scp = new StandardControlPanel(player,
      AbstractControlPanel.USE_START_CONTROL |
      AbstractControlPanel.USE_STOP_CONTROL);

          JButton startButton = new JButton("Start");
    scp.setStartButton(startButton);
   
    JButton stopButton = new JButton("Stop");
    stopButton.setEnabled(false);
          scp.setStopButton(stopButton);
   
          playerpanel.addControlComponent(scp);
          playerpanel.addVisualComponent();
    redraw();
      }
  };
  try {
      SwingUtilities.invokeAndWait(r);
  } catch (Exception e) {
      e.printStackTrace();
  }
  if (!waiter.blockingPrefetch()) {
      System.err.println("Can't prefetch Player");
      return;
  }
    }
View Full Code Here

        player = playerpanel.getPlayer();

        // Add ourselves as a listener to the player's events
        player.addControllerListener(this);

        StateWaiter waiter = new StateWaiter(player);

        // Wait for the Player to realize, then add the components
        if( ! waiter.blockingRealize() ) {
            System.err.println( "Could not realize Player" );
            return;
        }

        // Run Swing code on Swing Event thread
        Runnable r = new Runnable() {
            public void run() {
                // Add Control Panel Component
                playerpanel.addControlComponent();

                // Add Visual Component
                playerpanel.addVisualComponent();
            }
        };

        try {
            SwingUtilities.invokeAndWait(r);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

        if( ! waiter.blockingPrefetch() ) {
            System.err.println( "Could not prefetch Player" );
            return;
        }

        // Start Player
View Full Code Here

        playerpanel = getPlayerPanel();
        player = playerpanel.getPlayer();

        player.addControllerListener(this);

  StateWaiter waiter = new StateWaiter(player);

  waiter.blockingRealize();


        Runnable r = new Runnable() {
            public void run() {
                // Add Control Panel Component
                playerpanel.addControlComponent();

                // Add Visual Component
                playerpanel.addVisualComponent();
                redraw();

    TimeDisplayControl tdc = new TimeDisplayControl(player);
    Component c = tdc.getControlComponent();
    JFrame f = new JFrame("Time Display Control");
    f.getContentPane().add(c);
    f.pack();
    f.setVisible(true);

            }
        };
        SwingUtilities.invokeLater(r);

  waiter.blockingPrefetch();
        // Start Player
        player.start();

    }
View Full Code Here

  players = new Player[v.size()];
  v.copyInto(players);

  setLayout(createLayout(players.length));
  for (int i = 0; i < players.length; i++) {
      StateWaiter waiter = new StateWaiter(players[i]);
      waiter.blockingRealize();
      displayPlayer(players[i], tracks.getTrack(i).getMediaLocator());
      waiter.blockingPrefetch();
  }
    }
View Full Code Here

  * Create an NPlayerPanel from an array of Players.
  * In this case, Players are already constructed. 
  * Players are moved to prefetch state.
  */
    public NPlayerPanel(Player[] players) {
  StateWaiter  waiter;

  this.players = players;
  setLayout(createLayout(players.length));
  for (int i = 0; i < players.length; i++) {
      waiter = new StateWaiter(players[i]);
      waiter.blockingRealize();
      displayPlayer(players[i], null);
      waiter.blockingPrefetch();
  }
    }
View Full Code Here

TOP

Related Classes of ejmf.toolkit.util.StateWaiter

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.