Clicking on a JPanel to draw shapes

后端 未结 3 1110
没有蜡笔的小新
没有蜡笔的小新 2021-01-22 09:54

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. re

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-22 10:19

    Absent a complete example, it's hard to say. I'd expect your DrawingCanvas to override paintComponent() in order to render the accumulated Shape instances in shapeList. You might compare your approach to that shown in GaphPanel, cited here.

    image

提交回复
热议问题