Image not getting displayed on a JPanel.

Posted by Myth17 on Stack Overflow See other posts from Stack Overflow or by Myth17
Published on 2010-06-17T18:08:36Z Indexed on 2010/06/17 18:13 UTC
Read the original article Hit count: 178

Filed under:
|
|
 class Deal implements ActionListener
    {
        public void actionPerformed(ActionEvent e)
        {
             dl.setDeck();
             dl.shuffle();
             dl.firstDraw(pl);

             for(Card c:pl.showHand())
             panelplay.add(new JLabel(c.getImageIcon()));

             panelplay.validate();
        }
    }

This is an event handler for a Jbutton. The method pl.showHand() returns a ArrayList of a user defined class 'Card'. Inserting a println() inside the loop shows the print, so the code is being executed but the Panel panelplay isnt showing card Images.

© Stack Overflow or respective owner

Related posts about java

Related posts about gui