]> git.sesse.net Git - vlc/blob - bindings/java/org/videolan/jvlc/JVLCCanvas.java
13b2ca1eb16a817d0f362b0203e55c804d0dfe16
[vlc] / bindings / java / org / videolan / jvlc / JVLCCanvas.java
1 /*****************************************************************************
2  * JVLCCanvas.java: AWT Canvas containing VLC Video Output
3  *****************************************************************************
4  * 
5  * Copyright (C) 1998-2006 the VideoLAN team
6  * 
7  * Author: Filippo Carone <filippo@carone.org>
8  *
9  * Created on 25-nov-2005
10  *
11  * $Id$
12  * 
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2 of the
16  * License, or (at your option) any later version.
17  * 
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * General Public License for more details.
22  * 
23  * You should have received a copy of the GNU General Public
24  * License along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  * 
27  */
28
29 package org.videolan.jvlc;
30
31 import java.awt.Canvas;
32 import java.awt.Graphics;
33
34 public class JVLCCanvas extends Canvas {
35
36         /**
37          * Serial version UID
38          */
39         private static final long serialVersionUID = -1888309778861586426L;
40
41         public void paint(Graphics g) {
42                 jvlc.video.paint(g);
43         }
44
45     private final JVLC jvlc;
46     
47     /**
48      * Default constructor. The canvas is set a dimension of 200x200
49      */
50     public JVLCCanvas() {
51         super();
52         jvlc = new JVLC();
53         jvlc.video.setActualCanvas(this);
54         setSize(200, 200);
55     }
56     
57     public JVLCCanvas(String[] args) {
58         super();
59         jvlc = new JVLC(args);
60         jvlc.video.setActualCanvas(this);
61         setSize(200, 200);
62     }
63     
64     /**
65      * @param width The initial canvas width
66      * @param height The initial canvas height
67      */
68     public JVLCCanvas(int width, int height) {
69         super();
70         jvlc = new JVLC();
71         jvlc.video.setActualCanvas(this);        
72         setSize(width, height);
73     }
74     
75     public JVLCCanvas(String[] args, int width, int height) {
76         super();
77         jvlc = new JVLC(args);
78         jvlc.video.setActualCanvas(this);        
79         setSize(width, height);
80     }
81
82     public JVLCCanvas(JVLC jvlc) {
83         super();
84         this.jvlc = jvlc;
85         jvlc.video.setActualCanvas(this);        
86     }
87     
88     public JVLC getJVLC() {
89         return jvlc;
90     }
91     
92     /* (non-Javadoc)
93      * @see java.awt.Component#removeNotify()
94      */
95     public void removeNotify() {
96         super.removeNotify();
97         jvlc.destroy();
98     }
99
100 }