Normand Briere
2018-07-01 bb87fae3b097ddd5c5039bf1ab48d3718b900b08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package mocap.gui;
 
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
 
import javax.swing.JLabel;
import javax.swing.JPanel;
 
import mocap.JMocap;
import mocap.player.PlayerFrameListener;
 
/**
 *
 * @author Michael Kipp
 */
public class InfoPanel extends JPanel implements PlayerFrameListener {
 
    private static final Font FONT_INFO = new Font("Arial", Font.BOLD, 14);
    private static final Color COLOR_INFO = Color.BLUE;
    private JLabel _infoASF, _infoAMC, _infoTotalFrames, _infoFrame;
 
    public InfoPanel(JMocap app) {
        setLayout(new GridLayout(0, 1));
        _infoASF = createLabel("skeleton: ---");
        _infoAMC = createLabel("motion: ---");
        _infoTotalFrames = createLabel("total frames: ---");
        _infoFrame = createLabel("frame: ---");
//        app.getPlayer().addListener(this);
    }
 
    public void updateSkeleton(String name) {
        _infoASF.setText("skeleton: " + name);
    }
 
    public void updateAnim(String name) {
        _infoAMC.setText("motion: " + name);
    }
    
    public void updateTotalFrames(int n) {
        _infoTotalFrames.setText("total frames: " + n);
    }
 
    public void updateFrame(int n) {
        _infoFrame.setText("frame: " + n);
    }
 
    private JLabel createLabel(String text) {
        JLabel l = new JLabel(text);
        l.setFont(FONT_INFO);
        l.setForeground(COLOR_INFO);
        add(l);
        return l;
    }
 
    public void frameUpdate(int framenumber) {
        updateFrame(framenumber);
    }
}