Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package APP;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import javax.swing.ImageIcon;
- import javax.swing.JPanel;
- public class Panel extends JPanel {
- /**
- * Create the panel.
- */
- ImageIcon imagen ;
- String nombre ;
- public Panel(String nombre) {
- this.nombre=nombre;
- }
- public void paint (Graphics g){
- Dimension tamanio = getSize();
- imagen = new ImageIcon(getClass().getResource(nombre));
- g.drawImage(imagen.getImage(), 0, 0, tamanio.width , tamanio.height,null);
- setOpaque(false);
- super.paint(g);
- }
- }
Add Comment
Please, Sign In to add comment