Como colocar imagen en frame ?

diogenes
09 de Noviembre del 2002
Quiero colocar una imagen *.jpg en un frame y este me dice que no encuentra ni el metodo getImage(), ni el metodo getCodeBase() en el frame. Es que uno no puede colocar imagenes en un frame ? o debe utilizar otro mecanismo al que estoy usando ?.
Aqui va el codigo del programa

import java.awt.*; import java.awt.Graphics; import java.awt.Image;

class BaseFrame01_1 extends Frame { Label l; Canvas swatch; Frame window01; Image whig;

BaseFrame01_1(String title) {

super(title); setLayout(new GridLayout(3, 2)); swatch = new Canvas(); swatch.setBackground(Color.green); pepe(); add(swatch); add(swatch); add(swatch); add(swatch); pipo();

} void pepe() { Choice span = new Choice(); span.addItem("Notas"); span.addItem("Asistencia"); span.addItem("Comunicados"); add(span); }

void pipo() { Button cierra; cierra = new Button("Cerrar"); add(cierra);

}

public void init() { whig = getImage(getCodeBase(), "images/fillmore.jpg"); }

public void paint(Graphics screen) { int iWidth = whig.getWidth(this); int iHeight = whig.getHeight(this); int xPos = 10; // 25% screen.drawImage(whig, xPos, 10, iWidth / 4, iHeight / 4, this); // 100% xPos += (iWidth / 4) + 10; screen.drawImage(whig, xPos, 10, this); }

public boolean action(Event evt, Object arg) {

if (evt.target instanceof Button) {

String label = (String)arg; if (label.equals("Cerrar")) { hide(); } else { hide(); } return true;

} else {

if (evt.target instanceof Choice) { String label = (String)arg; if (label.equals("Notas")) { window01 = new Frama01_1("A Pop Up Window"); window01.resize(765,545); valida01(); return true; } else { if (label.equals("Asistencia")) { window01 = new Frame01_1("A Pop Up Window"); window01.resize(765,545); valida01(); return true; } else { if (label.equals("Comunicados")) { window01 = new Frami01_1("A Pop Up Window"); window01.resize(765,545); valida01(); return true; } else { return false; } } }

} else { return false;

}

}

}

public void valida01() { if (!window01.isShowing()) { window01.show(); } else { if (window01.isShowing()) window01.hide(); } }

public Insets getInsets() { return new Insets(40,40,40,40); } }