RECUERDA USAR LAS TAG'S DE CÓDIGO JAVA
Código
import java.awt.*;
import java.awt.event.*;
public class Nombre extends Frame implements WindowListener, ActionListener {
Button boton1 = new Button("Analizar");
TextField text1 = new TextField(1);
TextField text2 = new TextField(1);
TextField text3 = new TextField(1);
public Nombre() {
imagen foto = new imagen();
imagen2 foto2 = new imagen2();
setBackground(Color.cyan);//Color De Fondo De La Ventana
setSize(400, 400);//Tamaño De La Ventana
show();//Muestra El Frame
addWindowListener(this);//Interaccion Con Los Botones
boton1.setBounds(320, 322, 60, 20);
text1.setBounds(120, 120, 16, 20);
text2.setBounds(170, 120, 16, 20);
text3.setBounds(220, 120, 16, 20);
foto.setBounds(115, 25, 500, 500);
foto2.setBounds(115, 200, 500, 500);
boton1.addActionListener(this);
add(boton1);
add(text1);
add(text2);
add(text3);
add(foto);
}
public static void main(String[] argv) {
Nombre Principal = new Nombre();
}
public void windowOpened(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
class imagen extends Canvas {
Image imagen;//Variable
public void paint(Graphics g) {
imagen = Toolkit.getDefaultToolkit().getImage("A.png");
if (imagen != null) {
g.drawImage(imagen, 5, 5, this);
}
}
}
class imagen2 extends Canvas {
Image imagen2;//Variable
public void paint(Graphics g) {
imagen2 = Toolkit.getDefaultToolkit().getImage("B.png");
if (imagen2 != null) {
g.drawImage(imagen2, 5, 5, this);
}
}
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == boton1) {
if (text1.getText().equals("1") == true && text2.getText().equals("2") == true && text3.getText().equals("3") == true)
add(foto2);
}
}
}
Algo así es el código principal sobre la imagen... obviamente tengo mas código que no pondré por que es innecesario










Autor


En línea





