package Drawnings; import Drawnings.DrawningDumpTruck; import javax.swing.*; import java.awt.*; public class CanvasDumpTruck extends JComponent { public DrawningTruck _drawningTruck; public CanvasDumpTruck() {} public void paintComponent(Graphics g) { if (_drawningTruck == null) { return; } super.paintComponents(g); Graphics2D g2d = (Graphics2D) g; _drawningTruck.DrawTransport(g2d); super.repaint(); } }