I declare an object for a class with a value of 52, which then uses an arraylist and calls another class, and in that class the data fields are assigned a value, and then repaint is called, but it won't call the paint component.
Here is bits of the code
public class FA_Card extends JFrame { Cards card; Deck dC = new Deck(52);//calling the deck class JPanel draw = new JPanel(); JPanel content = new JPanel (); JPanel north = new JPanel (); JPanel north2 = new JPanel(); JPanel frame = new JPanel(); public FA_Card () { // Create a content pane //card = new Card (250, 500); content.setLayout (new BorderLayout ()); // Use FlowLayout for panel content.add(north,"West"); north.setLayout (new FlowLayout ()); // Use FlowLayout for input area north2.setLayout (new FlowLayout()); JPanel south = new JPanel (); south.setLayout (new FlowLayout ()); draw.add (dC, BorderLayout.CENTER); north.add (txt, "WEST"); txt.setEditable(false); content.add(draw,BorderLayout.CENTER);//adding the deck class object content.add (north, "West"); // Input area setContentPane (content); pack (); setTitle ("Cards"); //sets title of the program setSize (550, 600); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); //sets the default close operation to when you press close (X) setLocationRelativeTo (null); // Center window. //getContentPane ().add (card, BorderLayout.CENTER); } // FasihAwan_ArrayList class public static void main (String[] args) { FA_Card win = new FA_Card (); win.setVisible (true); win.setLocationRelativeTo (null); } } class Deck extends JPanel { String suit[] = {"c", "d", "h", "s"}; Cards card; public ArrayList <Cards> deck = new ArrayList <Cards> (); public Deck (int size) { for (int y = 1 ; y <= size ; y++) { deck.add (card = new Cards (y)); } } } class Cards extends JPanel { protected int rank, suit; //suite = c(1),d(2),h(3),s(4) protected boolean[] isUp = new boolean [52]; protected Image card = null; public int x=10,counter = 0,y = 10; public Cards (int c) //given a number { if (c > 13 && c < 27) { rank = c - 13; suit = 2; //isUp [rank * suit] = true; } else if (c > 26 && c < 40) { rank = c - 26; suit = 3; //isUp [rank * suit] = true; } else if (c > 39) { rank = c - 39; suit = 4; //isUp [rank * suit] = true; } else if (c < 14) { rank = c; suit = 1; //isUp [c] = true; } repaint(); } public void paintComponent (Graphics g) { super.paintComponent(g); g.setColor (Color.RED); g.fillOval(75, 75, 10, 10); x+=25; if (x == 335) { x= 10; y+= 10; } System.out.print ("CHECK-REPAINTED"); Image img = loadImage (rank + setSuit (suit) + ".gif"); g.drawImage (img, 10*x, 2*y, null); } }