View Javadoc

1   /*
2    * @(#)$Id:$
3    *
4    * Author		:	Ueli Kurmann, igesture@uelikurmann.ch
5    *                  
6    *
7    * Purpose		: 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date				Who			Reason
14   *
15   * 16.12.2008			ukurmann	Initial Release
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  
27  package org.ximtec.igesture.tool.gesturevisualisation;
28  
29  import java.awt.Dimension;
30  
31  import javax.swing.ImageIcon;
32  import javax.swing.JLabel;
33  import javax.swing.JPanel;
34  
35  import org.ximtec.igesture.core.Gesture;
36  import org.ximtec.igesture.core.GestureSample;
37  import org.ximtec.igesture.util.GestureTool;
38  
39  
40  /**
41   * Comment
42   * @version 1.0 16.12.2008
43   * @author Ueli Kurmann
44   */
45  public class NoteGesturePanel implements GesturePanel {
46  
47     Gesture< ? > gesture;
48  
49  
50     @Override
51     public void init(Gesture< ? > gesture) {
52        this.gesture = gesture;
53     }
54  
55  
56     @Override
57     public JPanel getPanel(Dimension dimension) {
58  
59        JPanel panel = null;
60  
61        if (gesture != null) {
62           JLabel label = new JLabel(new ImageIcon(GestureTool.createNoteImage(
63                 ((GestureSample)gesture).getGesture(), dimension.width,
64                 dimension.height)));
65  
66           panel = new JPanel();
67           panel.setOpaque(true);
68           panel.add(label);
69  
70        }
71        return panel;
72     }
73  }