example.FullScreenDemo   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 10
eloc 19
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A keyPressed(KeyEvent) 0 4 2
A keyReleased(KeyEvent) 0 2 1
A FullScreenDemo() 0 2 1
A keyTyped(KeyEvent) 0 2 1
A main(String[]) 0 2 1
A setup() 0 6 1
1
package example;
2
3
import org.gannacademy.cdf.graphics.Text;
4
import org.gannacademy.cdf.graphics.ui.AppWindow;
5
6
import java.awt.*;
7
import java.awt.event.KeyEvent;
8
import java.awt.event.KeyListener;
9
10
public class FullScreenDemo extends AppWindow implements KeyListener {
11
    public FullScreenDemo() {
12
        super("Full Screen", true);
13
    }
14
15
    protected void setup() {
16
        getDrawingPanel().setBackground(Color.BLACK);
17
        (new Text(getDrawingPanel().getWidth() + " × " + getDrawingPanel().getHeight() + " pixels", 100, 100, getDrawingPanel())).setStrokeColor(Color.WHITE);
0 ignored issues
show
Security Bug introduced by
Use try-with-resources or close this "Text" 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...
18
        (new Text("Esc to exit", 100, 200, getDrawingPanel())).setStrokeColor(Color.WHITE);
0 ignored issues
show
Security Bug introduced by
Use try-with-resources or close this "Text" 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...
19
        getDrawingPanel().addKeyListener(this);
20
        getDrawingPanel().requestFocus();
21
    }
22
23
    public static void main(String[] args) {
24
        new FullScreenDemo();
25
    }
26
27
    @Override
28
    public void keyTyped(KeyEvent e) {
0 ignored issues
show
Bug introduced by
An empty method may be confusing. Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.
Loading history...
29
30
    }
31
32
    @Override
33
    public void keyPressed(KeyEvent e) {
34
        if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
35
            System.exit(0);
36
        }
37
    }
38
39
    @Override
40
    public void keyReleased(KeyEvent e) {
0 ignored issues
show
Bug introduced by
An empty method may be confusing. Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.
Loading history...
41
42
    }
43
}
44