anonymous
  • anonymous
Java: If anybody can teach me how to run a video in a JFrame, let me know :D
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
jagatuba
  • jagatuba
Here is an example that you can play around with. This is straight from the horse's mouth (Oracle): import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import java.awt.Color; import java.awt.Font; import java.io.File; import javax.swing.*; import javax.media.*; class Play extends JFrame { private static final long serialVersionUID = 1L; private static JPanel playVideoPanel; private static JLabel displayLabel1; private static Timer timer; private static Player player; private static JPanel videoPanel; public void playGUI(){ JFrame frame= new JFrame(); playVideoPanel = new JPanel(); playVideoPanel.setBounds(0, 0, 1024, 768); playVideoPanel.setLayout(null); // Label to show the Text displayLabel1 = new JLabel( "Playing The Video"); displayLabel1.setBounds( 50, 150, 800, 50);///, displayLabel1.setFont( new Font("Serif", Font.BOLD, 36 )); // Adding video clip to the JPanel screen videoPanel=new JPanel(); try{ player = Manager.createRealizedPlayer(new MediaLocator( new File("C://DELTA.mpg").toURL() ) ); videoPanel.add(player.getVisualComponent()); videoPanel.setBounds( 30, 215, 500, 400 ); final Control controls[]=player.getControls(); player.start(); add(player.getControlPanelComponent()); }catch(Exception ee){} playVideoPanel.add(displayLabel1); frame.add(playVideoPanel); frame.add(videoPanel); //setSize(1024, 768); timer = new Timer(10000, new AutoTimer()); timer.start(); frame.setUndecorated(true); frame.setSize(1024, 768); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setVisible(true); } // this will display the main screen after playing the video class AutoTimer implements ActionListener { public void actionPerformed(ActionEvent e) { } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { Play play= new Play(); play.playGUI(); } }); } }

Looking for something else?

Not the answer you are looking for? Search for more explanations.