Presentacion

Páginas: 2 (309 palabras) Publicado: 28 de septiembre de 2010
package gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import portaretrato.Lista;

public class Avance extendsAbstractAction{

public static final int SIGUIENTE = 1;
public static final int ANTERIOR = 2;

Lista archivos;
Display pantalla;
Foto jpFoto;

public Avance(Lista archivos,Display pantalla) {
this.archivos = archivos;
this.pantalla = pantalla;
jpFoto=new Foto();
}

public void actionPerformed(ActionEvent e) {
Integerdireccion= Integer.parseInt(((Component)e.getSource()).getName());
if(direccion==null)return;
File actual = null;
switch(direccion){
case Avance.SIGUIENTE:actual=archivos.getSiguiente();
break;
case Avance.ANTERIOR:
actual=archivos.getAnterior();
break;
default:throw new UnsupportedOperationException("Método no permitido.");
}
BufferedImage bi = null;
try {
bi = ImageIO.read(actual);
} catch(IOException ex) {
Logger.getLogger(Avance.class.getName()).log(Level.SEVERE, null, ex);
}
this.jpFoto.setfotoActual(bi);
pantalla.remove(jpFoto);pantalla.add(jpFoto, BorderLayout.CENTER);

jpFoto.updateUI();
pantalla.publicarNombreArchivo(actual.getName());

}

}

package gui;

import java.awt.Graphics;
import java.awt.Image;import java.awt.image.BufferedImage;

/**

*/
public class Foto extends javax.swing.JPanel {
private Image fotoActual;

//CONSTRUCTOR

/** Creates new form Foto */
protected...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Presentacion
  • Presentacion
  • Presentacion
  • Presentacion
  • Presentacion
  • Presentacion
  • Presentacion
  • Presentacion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS