import javax.swing.*; import java.awt.*; public class Canvas extends JComponent { Form form; public Canvas(Form form) { this.form = form; } @Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; form.Draw(g2); } }