I want to add a picture to my GUI, but it doesn't seem to be able to display the picture. (Maybe it can't find it?) I get no errors, all that happens is a blank JFrame pops up. I'm using Eclipse, and the picture is in the same package I'm working in.
Code:
package josh_package;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
import java.awt.Image;
import javax.imageio.ImageIO;
public abstract class TrevCard extends JPanel implements ActionListener{
public static void main(String[] args)
{
JFrame f = new JFrame("Here's Your Card!");
JLabel label = new JLabel();
label.setIcon(new ImageIcon("Ace.png"));
f.add(label);
f.setLocationRelativeTo(null);
f.setSize(600, 300);
f.setVisible(true);
System.out.println("This is a program for cards!");
PlayingCard MyCard;
MyCard = new PlayingCard(5,2);
System.out.println(MyCard.GetValue());
System.out.println(MyCard.GetSuit());
}
}