docs.DrawingApp   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 21
c 0
b 0
f 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A main(String[]) 0 2 1
A setup() 0 9 1
1
package docs;
2
3
import org.gannacademy.cdf.graphics.geom.Ellipse;
4
import org.gannacademy.cdf.graphics.geom.Rectangle;
5
import org.gannacademy.cdf.graphics.ui.AppWindow;
6
7
import java.awt.*;
8
9
/**
10
 * Build your app as an extension of the AppWindow class (which sets up the window and drawing panel for you)
11
 */
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());
0 ignored issues
show
Security Bug introduced by
Use try-with-resources or close this "Rectangle" in a "finally" clause.

You may want to use try {} ... finally {} to close the resource or use the (relatively) new try-with-resources capability.

Loading history...
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());
0 ignored issues
show
Security Bug introduced by
Use try-with-resources or close this "Ellipse" in a "finally" clause.

You may want to use try {} ... finally {} to close the resource or use the (relatively) new try-with-resources capability.

Loading history...
32
    e.setFillColor(new Color(255, 100, 100, 200));
33
  }
34
}
35