CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    22

    internal frame display

    I have created a frame in which there is an internal jframe showing inside it. What i want to do is use the JMF video playback displaying in the internal frame not the main frame. Currently when i run the program the video plays over the whole frame. all i want it to do is play within the internalJFrame. And with me testing out the code before i added video both frames display so i know that showing both frames isn't the problem. the problem is showing the video inside the internal frame.
    Code:
    import javax.media.*;
    import javax.swing.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    
    public class Internal extends JFrame
    {
    	private JPanel mainPanel;
    	Player _player;
    	JFileChooser fileChooser;
    
    	public Internal()
    	{
    
    		mainPanel = new JPanel();
    		getContentPane().add(mainPanel);
    		mainPanel.setLayout(null);
    
    		addWindowListener( new WindowAdapter(){
    			public void windowClosing( WindowEvent e)
    			{
    				_player.stop();
    				_player.deallocate();
    				_player.close();
    				System.exit(0);
    			}
    		});
    
    
    
    
    
    		JInternalFrame f1 = new JInternalFrame("Preview",
    												true,
    												true,
    												true,
    												true);
    		f1.setBounds(810,20,500,370);
    
    		JPanel panel =(JPanel)getContentPane();
    		panel.setLayout(new BorderLayout());
    		String mediaFile = "DD.avi";
    		try{
    			// Video code
    		}
    		catch (Exception e) {
    			System.err.println("Got exception" + e );
    
    		//getContentPane().add(panel);
    
    		f1.getContentPane().add(panel);
    
    		mainPanel.add(f1);
    		f1.setVisible(true);
    
    		setTitle("Internal Demo");
    		setLocationRelativeTo(null);
    		setDefaultCloseOperation(EXIT_ON_CLOSE);
    		setVisible(true);
    		this.setExtendedState(Frame.MAXIMIZED_BOTH);
    	}
    }
    	public static void main(String[] args)
    	{
    		Internal in = new Internal();
    		in.show();
    	}
    
    }

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: internal frame display

    Norm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured