Drawing Multiple JComponents to a Frame
What you want to do is use a data structure of Car objects and loop through them in the paintComonent method. Something like List<Car> cars = new ArrayList<>(); …. @Override protected void paintComponent(Graphics g) { super.paintComponent(g); for (Car car : cars) { car.drawCar(g); } } The drawCar method would come from your Car class public … Read more