let’s do some debuging…
first, does your jButton1ActionPerformed(java.awt.event.ActionEvent evt) gets called? Put a println somewhere so you can determine that. When using swing, when pressing a JButton, it’s actionPerformed() gets called, but then maybe you call your method from it, we can’t tell.
second, if you do manage to succeed, every time card is painted program would reload image from the disk - very slow and intensive for the disk
what you need to do is preload an image and use same image every time, like:
// in card class constructor:
private BufferedImage card = ImageIO.read(...)
// in pintaCarta(Graphics g)
g.drawImage(card, ....)
third, you don’t even need JPanel for card… you can just load an image of a card into BufferedImage and use Graphics2D.drawImage(image, x,y,w,h,null). This is what I said in second section, just amplified on methodology.
forth, if you want to use swing components for displaying your cards, you need to add them to container, override it’s paintComponent() for drawing, and use setVisible(true) if needed. What you are doing now isn’t related to swing, you just store your image data in a object that is extending JPanel, but you don’t actually use JPanel functionality anywhere (or maybe you do add it somewhere, but then it won’t ever get painted with your code, only as JPanel, because you don’t override it’s paintComponent() ).
Hope it’s not much confusing. Good luck.