class Fond
¿Qué clase extiende FondoPanel?
Apuntes
class FondoPanel extends JDesktopPane { private Image imagen; private Image image; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // 🔹 Imagen principal imagen = new ImageIcon(getClass().getResource("/vista/imagenes/d43193c468e12a8.png")).getImage(); int anchoImg = imagen.getWidth(this); int altoImg = imagen.getHeight(this); double escala = Math.max((double) getWidth() / anchoImg, (double) getHeight() / altoImg); escala *= 0.2; int nuevoAncho = (int) (anchoImg * escala); int nuevoAlto = (int) (altoImg * escala); int x = (getWidth() - nuevoAncho) / 2 + 170; int y = (getHeight() - nuevoAlto) / 2 + 230; g.drawImage(imagen, x, y, nuevoAncho, nuevoAlto, this); // 🔹 Segunda imagen (encima) image = new ImageIcon(getClass().getResource("/vista/imagenes/62015001.png")).getImage(); int anchoImg2 = image.getWidth(this); int altoImg2 = image.getHeight(this); double escala2 = Math.max((double) getWidth() / anchoImg2, (double) getHeight() / altoImg2); escala2 *= 0.3; // tamaño ...
Estudia con juegos interactivos
Sube tus apuntes y genera flashcards, examenes y mas con IA
Empezar gratis