JMFPlayerPanel.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
org.xnap.plugin.viewer.jmfplayer |
![]() |
![]() |
XNap 3 |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
/*
* XNap
*
* A peer-to-peer and file sharing client.
*
* Copyright Kazaam 2002-2003.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* Modified by Steffen Pingel for XNap 3.
* - replaced JTabbedPane by JPanel
* - removed InformationPanel
* - removed Kazaam Logo
* - removed setIconTextGap() calls (to avoid Java 1.4 dependency)
* - removed setFont() calls
* - removed parentFrame
* - added l10n
*/
package org.xnap.plugin.viewer.jmfplayer;
import java.awt.Color;
import java.io.File;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.xnap.XNap;
import org.xnap.gui.XNapFrame;
import org.xnap.gui.util.IconHelper;
/*
* KazaamPreviewerDemo.java
*
* Created on December 29, 2002
* @author joker10000y
*/
public class JMFPlayerPanel extends JPanel {
/** Creates new form KazaamMediaPreview */
public JMFPlayerPanel()
{
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
PlayerToolbar = new javax.swing.JToolBar();
JButtonStop = new javax.swing.JButton();
JButtonFullScreenMode = new javax.swing.JButton();
RepeatPlaybackCheckbox = new javax.swing.JCheckBox();
ContentArea = new javax.swing.JPanel();
addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() {
public void ancestorMoved(java.awt.event.HierarchyEvent evt) {
}
public void ancestorResized(java.awt.event.HierarchyEvent evt) {
formAncestorResized(evt);
}
});
setToolTipText("Media Preview");
setLayout(new java.awt.BorderLayout());
JButtonStop.setIcon(IconHelper.getToolBarIcon("noatunstop.png"));
JButtonStop.setToolTipText(XNap.tr("Stop Media Playback"));
JButtonStop.setBorderPainted(false);
JButtonStop.setMargin(new java.awt.Insets(0, 0, 0, 0));
JButtonStop.setEnabled(false);
JButtonStop.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
JButtonStopActionPerformed(evt);
}
});
PlayerToolbar.add(JButtonStop);
JButtonFullScreenMode.setIcon(IconHelper.getToolBarIcon("fullscreen.png"));
JButtonFullScreenMode.setToolTipText(XNap.tr("Play Media in Full Screen Mode"));
JButtonFullScreenMode.setBorderPainted(false);
JButtonFullScreenMode.setMargin(new java.awt.Insets(0, 0, 0, 0));
JButtonFullScreenMode.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
JButtonFullScreenModeActionPerformed(evt);
}
});
PlayerToolbar.add(JButtonFullScreenMode);
RepeatPlaybackCheckbox.setText(XNap.tr("Continuous Playback"));
RepeatPlaybackCheckbox.setToolTipText(XNap.tr("Continuously Repeat Playback of the Media File"));
RepeatPlaybackCheckbox.setMargin(new java.awt.Insets(0, 0, 0, 0));
RepeatPlaybackCheckbox.setRolloverEnabled(true);
RepeatPlaybackCheckbox.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
RepeatPlaybackCheckboxActionPerformed(evt);
}
});
PlayerToolbar.add(RepeatPlaybackCheckbox);
add(PlayerToolbar, java.awt.BorderLayout.SOUTH);
ContentArea.setLayout(new java.awt.BorderLayout());
ContentArea.setBackground(new java.awt.Color(0, 0, 0));
ContentArea.setForeground(new java.awt.Color(255, 255, 255));
// add dummy component to fill the area
ContentArea.add(new JLabel(), java.awt.BorderLayout.CENTER);
add(ContentArea, java.awt.BorderLayout.CENTER);
}
private void RepeatPlaybackCheckboxActionPerformed(java.awt.event.ActionEvent evt)
{
if(RepeatPlaybackCheckbox.isSelected()==true)
{
KazaamMediaPlayer.setLoopPlayback(true);
}
else if(RepeatPlaybackCheckbox.isSelected()==false)
{
KazaamMediaPlayer.setLoopPlayback(false);
}
}
public void setOpenFile(File theMediaFile)
{
if(KazaamMediaPlayer.isStarted()==true)
{
stopPlayer();
}
try
{
myPlayerPanel = new KazaamMediaPlayer();
//myPlayerPanel.setLayout(new java.awt.BorderLayout());
myPlayerPanel.setBackground(Color.black);
myPlayerPanel.setDoubleBuffered(true);
add(myPlayerPanel,"Center");
myPlayerPanel.setPlayFile(theMediaFile);
JButtonStop.setEnabled(true);
}
catch(Exception e)
{
System.out.println(e);
}
//MyPlayerPanel.setSize(MyPlayerPanel.getMaximumSize());
}
private void JButtonStopActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
try
{
stopPlayer();
}
catch(Exception e){}
}
public void stopPlayer()
{
try
{
JButtonStop.setEnabled(false);
myPlayerPanel.stop();
remove(myPlayerPanel);
myPlayerPanel=null;
//repaintAll();
}
catch(Exception e){}
}
private void JButtonPauseActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
myPlayerPanel.pause();
}
private void JButtonFullScreenModeActionPerformed(java.awt.event.ActionEvent evt)
{
myPlayerPanel.setFullScreen(true, XNapFrame.getInstance());
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
private void formAncestorResized(java.awt.event.HierarchyEvent evt) {
//repaintAll();
}
// private void repaintAll()
// {
// getRootPane().repaint(new Rectangle(theParentFrame.getBounds()));
// }
// Variables declaration - do not modify
private javax.swing.JButton JButtonFullScreenMode;
private javax.swing.JToolBar PlayerToolbar;
private javax.swing.JPanel ContentArea;
private javax.swing.JButton JButtonStop;
private javax.swing.JCheckBox RepeatPlaybackCheckbox;
private KazaamMediaPlayer myPlayerPanel;
// End of variables declaration
}
The table below shows all metrics for JMFPlayerPanel.java.




