Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * @(#)MovieConverterPanel.java 
   * 
   * Copyright (c) 2011 Werner Randelshofer, Goldau, Switzerland.
   * All rights reserved.
   * 
   * You may not use, copy or modify this file, except in compliance with the
   * license agreement you entered into with Werner Randelshofer.
   * For details see accompanying license terms.
  */
 package org.monte.movieconverter;
 
MovieConverterPanel.

Author(s):
Werner Randelshofer
Version:
$Id: MovieConverterPanel.java 300 2013-01-03 07:40:34Z werner $
 
 public class MovieConverterPanel extends javax.swing.JPanel {
 
     private ExecutorService executor;
 private Buffer imageBuffer=new Buffer();
     private class Handler implements PropertyChangeListener {
 
         @Override
         public void propertyChange(PropertyChangeEvent evt) {
             if (evt.getPropertyName() == .) {
                 updateImage();
             }
         }
     }
     private Handler handler = new Handler();
     private long imageTime = -1;

    
Creates new form MovieConverterPanel
 
     public MovieConverterPanel() {
         initComponents();
 
     }
 
     @Override
     public void setTransferHandler(TransferHandler newHandler) {
         super.setTransferHandler(newHandler);
         .setTransferHandler(newHandler);
         .setTransferHandler(newHandler);
         .setTransferHandler(newHandler);
         .putClientProperty("Quaqua.ToolBar.style""bottom");
     }
 
     private void updateImage() {
         final Movie movie = getMovie();
         if (movie == null) {
             return;
         }
 
         execute(new Worker<BufferedImage>() {
 
             @Override
             protected BufferedImage construct() throws Exception {
                 Rational time=movie.getInsertionPoint(); 
                 
                 
                 return null;
             }
 
             @Override
             protected void done(BufferedImage value) {
                 .setImage(value);
             }
             
         });
     }
 
     public void execute(Runnable worker) {
         if ( == null) {
              = Executors.newSingleThreadExecutor();
         }
         .execute(worker);
     }

    
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
 
     @SuppressWarnings("unchecked")
     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
         = new javax.swing.JToolBar();
         = new javax.swing.JLabel();
         = new javax.swing.JPanel();
         = new org.monte.media.gui.ImagePanel();
        setLayout(new java.awt.BorderLayout());
        .setFloatable(false);
        .setRollover(true);
        .setText(" ");
        .add();
        .setLayout(new java.awt.BorderLayout());
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToolBar toolBar;
    // End of variables declaration//GEN-END:variables
    public void setMovie(Movie movie) {
        Movie oldValue = .getMovie();
        if (oldValue != null) {
            oldValue.removePropertyChangeListener();
        }
        .setMovie(movie);
        if (movie != null) {
            movie.addPropertyChangeListener();
        }
         = -1;
      
        updateImage();
    }
    private Movie getMovie() {
        return .getMovie();
    }
New to GrepCode? Check out our FAQ X