1 import org.videolan.jvlc.*;
4 import java.awt.event.*;
6 class VLCPlayerFrame extends Frame {
7 public VLCPlayerFrame() {
11 private void initComponents() {
12 java.awt.GridBagConstraints gridBagConstraints;
14 fullScreenButton = new javax.swing.JButton();
15 jTextField1 = new javax.swing.JTextField();
16 setButton = new javax.swing.JButton();
17 pauseButton = new javax.swing.JButton();
18 stopButton = new javax.swing.JButton();
20 // jPanel = new javax.swing.JPanel();
21 jvcc = new JVLCCanvas();
22 jvlc = jvcc.getJVLCObject();
23 // jPanel.add( jvcc );
26 // FIXME: Does not work with GridBagLayout
27 setLayout(new java.awt.GridLayout(3,2));
29 gridBagConstraints = new java.awt.GridBagConstraints();
30 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
31 // add( jPanel , gridBagConstraints);
34 fullScreenButton.setText("FullScreen");
35 fullScreenButton.addActionListener(new java.awt.event.ActionListener() {
36 public void actionPerformed(java.awt.event.ActionEvent evt) {
37 fullScreenButtonActionPerformed(evt);
41 gridBagConstraints = new java.awt.GridBagConstraints();
42 gridBagConstraints.gridx = 0;
43 gridBagConstraints.gridy = 2;
44 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
45 add( fullScreenButton, gridBagConstraints);
48 jTextField1.setText("URL");
49 gridBagConstraints = new java.awt.GridBagConstraints();
50 gridBagConstraints.gridx = 0;
51 gridBagConstraints.gridy = 1;
52 gridBagConstraints.gridwidth = 2;
53 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
54 add(jTextField1, gridBagConstraints);
57 setButton.setText("Set item");
58 setButton.addActionListener(new java.awt.event.ActionListener() {
59 public void actionPerformed(java.awt.event.ActionEvent evt) {
60 setButtonActionPerformed(evt);
63 gridBagConstraints = new java.awt.GridBagConstraints();
64 gridBagConstraints.gridx = 2;
65 gridBagConstraints.gridy = 1;
66 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
67 add(setButton, gridBagConstraints);
70 pauseButton.setText("Play/Pause");
71 pauseButton.addActionListener(new java.awt.event.ActionListener() {
72 public void actionPerformed(java.awt.event.ActionEvent evt) {
73 pauseButtonActionPerformed(evt);
76 gridBagConstraints = new java.awt.GridBagConstraints();
77 gridBagConstraints.gridx = 1;
78 gridBagConstraints.gridy = 2;
79 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
80 add(pauseButton, gridBagConstraints);
82 stopButton.setText("Stop");
83 stopButton.addActionListener(new java.awt.event.ActionListener() {
84 public void actionPerformed(java.awt.event.ActionEvent evt) {
85 stopButtonActionPerformed(evt);
88 gridBagConstraints = new java.awt.GridBagConstraints();
89 gridBagConstraints.gridx = 2;
90 gridBagConstraints.gridy = 2;
91 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
92 add(stopButton, gridBagConstraints);
97 private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {
101 private void pauseButtonActionPerformed(java.awt.event.ActionEvent evt) {
105 private void setButtonActionPerformed(java.awt.event.ActionEvent evt) {
107 jvlc.playlistClear();
108 jvlc.addTarget( jTextField1.getText(), null, 1, -666 );
112 private void fullScreenButtonActionPerformed(java.awt.event.ActionEvent evt) {
116 private javax.swing.JButton setButton;
117 private javax.swing.JButton pauseButton;
118 private javax.swing.JButton stopButton;
119 private javax.swing.JButton fullScreenButton;
120 private javax.swing.JTextField jTextField1;
121 private javax.swing.JPanel jPanel;
122 private JVLCCanvas jvcc;
127 public class VlcClient {
129 public static void main(String[] args) {
130 Frame f = new VLCPlayerFrame();
131 f.setBounds(0, 0, 500, 500);
132 f.addWindowListener( new WindowAdapter() {
133 public void windowClosing(WindowEvent ev) {