Clicking on a JPanel to draw shapes
I have a JFrame containing 3 JPanels; Options, menu, canvas. In options there are a number of JButtons representing shapes. The aim is to click on the JButton of a shape e.g. rectangle, then click anywhere on the canvas and the shape will be drawn there. For some reason, the shape does not always get drawn, it is only drawn when I click somewhere in the top left area of the canvas. Also the shape seems to randomly change size depending on where I click. Here are some of my code snippets, it's probably a small error but I just can't seem to find it. Shape: public class Shape extends JPanel {