rohanbk 0 Newbie Poster

Hi:
I'm having trouble trying to place images in a Java GUI. Basically, I have an array that contains a 52 card deck in String form, and whenever I call one entry from the array, I want to display a gif image of that card.

For example:

if(cardarray.compareTo("King of Hearts")==0){
//display the king of hearts card (KOH.gif)
}

I looked through other forums and many people recommend using JLabel.

JLabel picLabel = new JLabel(new ImageIcon("/j.gif","joker"));

Would this work? As an addendum, I'm currently using the Netbeans IDE.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.