Results 1 to 5 of 5
  1. #1
    jumpman8947 is offline Member
    Join Date
    Feb 2013
    Posts
    38
    Rep Power
    0

    Default jinternalframe question

    I currently made a program where i have an internal frame on a desktop pane. That works fine, but what i'm trying to do is have a media player streaming only on the internal frame not the desktop pane. When i added my media player the desktop pane still shows but the internal frame doesn't and i know that the media is playing because i can hear it, but it the internal frame and the video doesn't display.
    Java Code:
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JInternalFrame;
    import javax.media.*;
    
    public class InternalTest extends JFrame
    {
    	JDesktopPane dp;
    	Player _player;
    
    	public InternalTest()
    	{
    
    	 dp = new JDesktopPane();
    	add(dp);
    	setContentPane(dp);
    	setLayout(null);
    	JButton button3 = new JButton("Hope this Works");
    	button3.setBounds(500,300,100,100);
    	dp.add(button3);
    	/*setLayout(new BorderLayout());
    	JPanel panel1 = new JPanel();
    	JPanel panel2 = new JPanel();
    	JButton button1 = new JButton("North Button");
    	panel1.add(button1);
    	add(panel1,BorderLayout.NORTH);
    	add(panel2,BorderLayout.SOUTH); */
    
    	JInternalFrame frame = new JInternalFrame("Preview",
    												true,
    												true,
    												true,
    												true);
    	frame.setVisible(true);
    	frame.setSize(500,500);
    	frame.setLayout(new BorderLayout());
    	JButton button1 = new JButton("North Button");
    	button1.setBounds(0,10,50,50);
    	frame.add(button1);
    
    	frame.add(button1);
    
    	JPanel panel = new JPanel();
    
    	String mediaFile = "DD.avi";
    	try{
    		MediaLocator mlr = new MediaLocator("file:" + mediaFile );
    		_player = Manager.createRealizedPlayer(mlr);
    		if ( _player.getControlPanelComponent() !=null)
    		panel.add("South", _player.getControlPanelComponent());
    		_player.start();
    	}
    	catch (Exception e){
    		System.err.println("Got exception" + e );
    
    	frame.getContentPane().add(panel);
    	dp.add(frame);
    	//panel2.add(frame);
    
    
    	addWindowListener( new WindowAdapter(){
    				public void windowClosing( WindowEvent e)
    				{
    					_player.stop();
    					_player.deallocate();
    					_player.close();
    					System.exit(0);
    				}
    		});
    
    	setLocationRelativeTo(null);
    	setDefaultCloseOperation(EXIT_ON_CLOSE);
    	setVisible(true);
    	setTitle("Hope this works");
    	this.setExtendedState(Frame.MAXIMIZED_BOTH);
    }
    
    
    
    }
    public static void main(String[] args)
    {
    	InternalTest it = new InternalTest();
    	it.show();
    }
    
    
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: jinternalframe question

    Quote Originally Posted by jumpman8947 View Post
    Java Code:
    	add(dp);
    	setContentPane(dp);
    	setLayout(null);
    What exactly were you trying to achieve with these three lines?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: jinternalframe question

    Also, with lines 39-44?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    jumpman8947 is offline Member
    Join Date
    Feb 2013
    Posts
    38
    Rep Power
    0

    Default Re: jinternalframe question

    Quote Originally Posted by DarrylBurke View Post
    What exactly were you trying to achieve with these three lines?

    db
    I know i dont need add(dp), or setContentPane(dp), even if i take those out the program still doesn't work, i set the layout to null because that's just my choice of layout for this program.

  5. #5
    jumpman8947 is offline Member
    Join Date
    Feb 2013
    Posts
    38
    Rep Power
    0

    Default Re: jinternalframe question

    lines 39-44, i want the internal frame set to border layout because its easier to put my video components into a border layout. And lines 40-44 i accidently left them in by mistake even after taking them out the program still has the same problem.

Similar Threads

  1. jInternalFrame question
    By nikos6707 in forum Java 2D
    Replies: 0
    Last Post: 11-07-2011, 11:18 AM
  2. Replies: 1
    Last Post: 09-27-2011, 04:19 PM
  3. Replies: 4
    Last Post: 09-27-2011, 09:20 AM
  4. Replies: 0
    Last Post: 08-09-2011, 06:07 PM
  5. JInternalFrame Help
    By collin389 in forum New To Java
    Replies: 2
    Last Post: 03-16-2010, 12:23 AM

Posting Permissions

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