View Javadoc

1   /**
2    * 
3    */
4   package org.ximtec.igesture.tool.gesturevisualisation;
5   
6   import java.awt.Dimension;
7   
8   import javax.swing.ImageIcon;
9   import javax.swing.JLabel;
10  import javax.swing.JPanel;
11  
12  import org.ximtec.igesture.core.Gesture;
13  import org.ximtec.igesture.core.GestureSample3D;
14  import org.ximtec.igesture.util.GestureTool;
15  
16  /**
17   * @author Bjorn Puype, bpuype@gmail.com
18   *
19   */
20  public class RecordedGesture3DPanel implements GesturePanel {
21  
22  	Gesture< ? > gesture;
23  	
24  	/* (non-Javadoc)
25  	 * @see org.ximtec.igesture.tool.gesturevisualisation.GesturePanel#getPanel(java.awt.Dimension)
26  	 */
27  	@Override
28  	public JPanel getPanel(Dimension dimension) {
29  		JPanel panel = null;
30  
31  	      if (gesture != null) {
32  	         JLabel label = new JLabel(new ImageIcon(GestureTool.createRecordedGesture3DImage(
33  	        		 ((GestureSample3D)gesture).getGesture(), dimension.width, dimension.height)));
34  			
35  	         panel = new JPanel();
36  	         panel.setOpaque(true);
37  	         panel.add(label);
38  
39  	      }
40  	      return panel;
41  	}
42  
43  	/* (non-Javadoc)
44  	 * @see org.ximtec.igesture.tool.gesturevisualisation.GesturePanel#init(org.ximtec.igesture.core.Gesture)
45  	 */
46  	@Override
47  	public void init(Gesture<?> gesture) {
48  		this.gesture = gesture;
49  	}
50  
51  }