| Total Complexity | 2 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package docs; |
||
| 12 | public class DrawingApp extends AppWindow { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Start your app by instantiating it in your main method |
||
| 16 | */ |
||
| 17 | public static void main(String[] args) { |
||
| 18 | new DrawingApp(); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Override the setup() method to define your drawing |
||
| 23 | */ |
||
| 24 | @Override |
||
| 25 | protected void setup() { |
||
| 26 | // draw a blue rectangle with a thick outline |
||
| 27 | Rectangle r = new Rectangle(200, 75, 200, 200, getDrawingPanel()); |
||
|
|
|||
| 28 | r.setFillColor(Color.BLUE); |
||
| 29 | |||
| 30 | // draw a red, transparent circle with a thick outline |
||
| 31 | Ellipse e = new Ellipse(250, 125, 200, 200, getDrawingPanel()); |
||
| 32 | e.setFillColor(new Color(255, 100, 100, 200)); |
||
| 33 | } |
||
| 35 |
You may want to use
try {} ... finally {}to close the resource or use the (relatively) new try-with-resources capability.