Java/PHP Developer
HI,
I want to know how can we place a link in one jframe to open a videopanel.
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class MediaTest
{
// launch the application
@SuppressWarnings("deprecation")
public static void main( String args[] )
{
// create a file chooser
JFileChooser fileChooser = new JFileChooser();
// show open file dialog
int result = fileChooser.showSaveDialog( null );
if ( result == JFileChooser.APPROVE_OPTION ) // user chose a file
{
URL mediaURL = null;
try
{
// get the file as URL
mediaURL = fileChooser.getSelectedFile().toURL();
} // end try
catch ( MalformedURLException malformedURLException )
{
System.err.println( "Could not create URL for the file" );
} // end catch
if ( mediaURL != null ) // only display if there is a valid URL
{
JFrame mediaTest = new JFrame( "Media Tester" );
mediaTest.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
MediaPanel mediaPanel = new MediaPanel( mediaURL );
mediaTest.add( mediaPanel );
mediaTest.setSize( 300, 300 );
mediaTest.setVisible( true );
} // end inner if
} // end outer if
} // end main
} // end class MediaTest
import java.awt.BorderLayout;
import java.awt.Component;
import java.io.IOException;
import java.net.URL;
import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.swing.JPanel;
public class MediaPanel extends JPanel
{
/**
*
*/
private static final long serialVersionUID = 1L;
public MediaPanel( URL mediaURL )
{
setLayout( new BorderLayout() ); // use a BorderLayout
// Use lightweight components for Swing compatibility
Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
try
{
// create a player to play the media specified in the URL
Player mediaPlayer = Manager.createRealizedPlayer( mediaURL );
// get the components for the video and the playback controls
Component video = mediaPlayer.getVisualComponent();
Component controls = mediaPlayer.getControlPanelComponent();
if ( video != null )
add( video, BorderLayout.CENTER ); // add video component
if ( controls != null )
add( controls, BorderLayout.SOUTH ); // add controls
mediaPlayer.start(); // start playing the media clip
} // end try
catch ( NoPlayerException noPlayerException )
{
System.err.println( "No media player found" );
} // end catch
catch ( CannotRealizeException cannotRealizeException )
{
System.err.println( "Could not realize media player" );
} // end catch
catch ( IOException iOException )
{
System.err.println( "Error reading from the source" );
} // end catch
} // end MediaPanel constructor
} // end class MediaPanel
View Answers
November 29, 2011 at 12:14 PM
Related Tutorials/Questions & Answers:
Java/PHP DeveloperJava/
PHP Developer help me with passing data from jframe to text file please
Java/PHP DeveloperJava/
PHP Developer please help me to bring cell values of jtable to a text file
Advertisements
Java/PHP DeveloperJava/
PHP Developer how to remove and add a new contentpane on same frame do we have any methods
Java/PHP DeveloperJava/
PHP Developer Hi,
can u help me with,
question from a text file and answers from another text file with check box
Java/PHP DeveloperJava/
PHP Developer Hi, I need a cloak embedded in
java swing frame or panel..And it should not change when system time is changed ..please
Java/PHP DeveloperJava/
PHP Developer Hi,
can u help me to embedd time on
java frame and it should be independent of operating system time..if we change system time it should'nt be changed..
Thank you sir
Java/PHP DeveloperJava/
PHP Developer how can we get words seperated by delimeters in text file can be imported in jframe like one word for one line
Java/PHP DeveloperJava/
PHP Developer Hi,
how to create radio buttons on one pannel and should change when pressed ok...
can u help me htrough this sooner...
THANK U
Java/PHP DeveloperJava/
PHP Developer Hi,
can u please help me with this,
I have a text file with 3 sentences separated by delimiters and i want to get each sentence in different JFrames when press ok button on first frame it should close
Java/PHP DeveloperJava/
PHP Developer Hi, can u help me with, question from a text file and answers from another text file with check box.....
like a text file containing questions and another text file containing answer of 3 r 4 options,each one
Java/PHP DeveloperJava/
PHP Developer Hi, can u help me with, question from a text file and answers from another text file with check box.....
like a text file containing questions and another text file containing answer of 3 r 4 options,each one
Java/PHP DeveloperJava/
PHP Developer Hi,
I have a textfile(notepad1.txt) with 1 question and another textfile(notepad2.txt) with answers(4 options like multiple choice),question is imported from first text file to jframe and 4 options with check
Java/PHP DeveloperJava/
PHP Developer Hello sir,
Am working on playing audio file in jframe and im not able to import javax.media into the code..
the code.../
java/javase/download-142937.html
After downloading, put the jar file under the lib
Java/PHP DeveloperJava/
PHP Developer HI,
I want to know how can we place a link in one jframe to open a videopanel.
import java.net.MalformedURLException;
import...
} // end MediaPanel constructor
} // end class MediaPanel
Java create
plsql developerplsql developer how did plsql
developer provided the information to the frent end people when ever they contact plsql
developer and how plsql
developer tck the data from the database
Java DeveloperJava Developer Hi,
I am engineering student. I want to make career in as
Java Developer. How to become a
Java Developer? What programming languages... an expert
Java Developer?
Thanks
App DeveloperApp Developer Hi,
Who is App
Developer?
Thanks
Hi,
App
Developer is the term used for the programmers or companies developing mobile applications.
Mobile application or simply app is the hot trend there days
ModuleNotFoundError: No module named 'developer'ModuleNotFoundError: No module named '
developer' Hi,
My Python... '
developer'
How to remove the ModuleNotFoundError: No module named '
developer' error?
Thanks
Hi,
In your python environment you
Developer Files - Development processDeveloper Files Hi, I dont have real time experience. can u tell as a j2ee
developer should i edit struts properties files or not . like wise changes in any other properties file. Thanks Prakash
Developer discussion forumsDeveloper discussion forums Hi,
What is discussion forums? Is there any good forum for discussion programming technologies?
Thanks... managed and spam protected.
You can check LiveTechTalk.com -
Developer discussion
Hire iPhone developerHire iPhone
developer - Hire iPhone developers in India
Apple?s iPhone... few efficient
developer in this field.
If you want to develop any outstanding... programmer or hire iPhone
app
developer who can develop an iPhone application
ai developer courseai
developer course Hi,
I am beginner in Data Science and machine learning field. I am searching for
the tutorials to learn:
ai
developer course... the
topic "ai
developer course". Also tell me which is the good training
iPhone apps developeriPhone apps
developer
With the launch of Apple's innovative product iPhone that comprises three
advanced products in it-a smart mobile, a faster internet connection and
advanced multimedia devices with touch screen and virtual
Mozilla Developer Center
Mozilla
Developer Center
Great site to get a first look at AJAX.
Read full DescriptionADS_TO_REPLACE_1
What are job role of Hadoop Developer?What are job role of Hadoop
Developer? Hi,
I am planning to get the the job in Hadoop Development as Hadoop
Developer. What are the roles of a Hadoop
Developer?
Thanks
Looking to Hire Magento Website Developer?Looking to Hire Magento Website
Developer? Are you searching for Magento ecommerce development solution? Then you have arrived on the right place... at reasonable prices. You can hire Magento ecommerce
developer from us
google developer machine learning bootcampgoogle
developer machine learning bootcamp Hi,
I am beginner... to learn:
google
developer machine learning bootcamp
Try to provide me good examples or tutorials links so that I can learn the
topic "google
developer What is the salary of Python developer in India?What is the salary of Python
developer in India? Hi,
I am beginner... to learn:
What is the salary of Python
developer in India?
Try to provide me... is the salary of Python
developer in India?". Also tell me which is the good
Searching Mobile developer for image recognitionSearching Mobile
developer for image recognition Hi,
I have an idea for an application that requires image recognition. I have decided to use... of calling web services.
Developer should have at least 5 years of experience
java developerjava developer i didnt get the correct ANSWER PLZ EXECUTE THE FOOLWING SERVLET BY USING DATABASE USERLOGIN TABLE VALUES.
//validate login.html
<html>
<body>
<body bgcolor="wheat">
<center>
Java DeveloperJava Developer What is scenario where i use interface and where use interface
Java DeveloperJava Developer where we should use interface and where we should use abstract class
How to become a PHP Developer? PHP developer. This explains you all the technologies you have to learn to become a
PHP Developer. You will definitely find this step-by-step tutorial very....
To become a
PHP developer following the following steps:ADS_TO_REPLACE_1
How
PHP Application Developer in IndiaPHP Application
Developer in India
We offer
PHP Application
Developer in India... using
PHP
language.
Roseindia, a leading
PHP developer India has a strong... in Application development in
PHP
framework.
PHP is a very powerful open source
PHP Application Developer in IndiaPHP Application
Developer in India
We offer
PHP Application
Developer in India... using
PHP
language.
Roseindia, a leading
PHP developer India has a strong... in Application development in
PHP
framework.
PHP is a very powerful open source
PHP Application Developer in IndiaPHP Application
Developer in India
We offer
PHP Application
Developer in India... using
PHP
language.
Roseindia, a leading
PHP developer India has a strong... in Application development in
PHP
framework.
PHP is a very powerful open source
PHP Application Developer in IndiaPHP Application
Developer in India
We offer
PHP Application
Developer in India...
developer India has a strong
network of
PHP professionals that can develop... in Application development in
PHP
framework.
PHP is a very powerful open source
Perl Developer
Perl
Developer
Position Vacant: Perl
Developer
Job Description
We...
Experience: 1- 6 Years
Keywords:
Perl,
Developer, Unix