Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: how to display a video from a JList?

  1. #1
    mathidioticz is offline Member
    Join Date
    Jan 2012
    Posts
    48
    Rep Power
    0

    Default how to display a video from a JList?

    I am currently doing an application using Swing and i am stuck at a certain point. In my function, i have to link videos from a JList. The problem is i am not sure how to link the videos from the JList. I am using an OpenBrowser class to link the video to the internet. I did consider using JButton but i would have to hard-code the button and that would be ugly. At this point, i am able to display the list of videos that i hard-coded however, in the actual
    function, i would have to retrieve the videos from the database and display it in the Internet. I have already tried launching it with a double click on a
    JList entry but from there i am not sure how to go to the internet. Is there any other alternatives to do this? I am in desperate need and would be eternally grateful to whoever that can help me.

    Java Code:
    private JList getJListVideos() {
    		if (jListVideos == null) {
    			String[] videos = {"v1", "v2", "v3", "v4", "v5"};
    			jListVideos = new JList(videos);
    			jListVideos.setFixedCellHeight(27); 
    			jListVideos.setFixedCellWidth(130); 
    			jListVideos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    			
    			jListVideos.addMouseListener(new MouseAdapter() {
    			   public void mouseClicked(MouseEvent evt) {
    			        JList list = (JList)evt.getSource();
    			        if (evt.getClickCount() == 2) {  //check if it is a Double-click
    			        int index = list.locationToIndex(evt.getPoint());
    			             //do whatever you want with the entry at that index
    			        String kbs = (String) jListVideos.getSelectedValue();
                		KBSVideos k1 = new KBSVideos();
                		k1.retrieveKBS();
                		ViewKBSVideosFrame kbsFrame = new ViewKBSVideosFrame(k1); 
                		kbsFrame.setVisible(true);
                		k1.getKbs_videoURL();
                		System.out.println(k1.retrieveKBS());
                		
    			        }
    			            }
    			});
    			   return jListVideos;
    			    }
    		return jListArticles;
    			}

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,918
    Rep Power
    16

    Default Re: how to display a video from a JList?

    What's this 'Internet' you refer to? It's obviously not the Intenet as generally understood.

    Moving to the Swing section.

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

  3. #3
    mathidioticz is offline Member
    Join Date
    Jan 2012
    Posts
    48
    Rep Power
    0

    Default Re: how to display a video from a JList?

    The internet that i am referring to is the internet we generally understand. In my case, as i wish to retrieve videos, i want to go to Youtube for example.
    Sorry if i was not clear in the question.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,918
    Rep Power
    16

    Default Re: how to display a video from a JList?

    i would have to retrieve the videos from the database and display it in the Internet.
    i am not sure how to go to the internet.
    The internet that i am referring to is the internet we generally understand.
    Certainly not the meaning of the word as I understand it.

    db
    Bestsanchez likes this.
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. Replies: 1
    Last Post: 01-25-2012, 05:10 PM
  2. Collection to JList to Display
    By D.Calladine in forum New To Java
    Replies: 1
    Last Post: 12-03-2010, 12:53 PM
  3. [SOLVED] JList( Vector ) Display problem
    By logicbug in forum AWT / Swing
    Replies: 4
    Last Post: 03-21-2009, 02:28 PM
  4. How do I display a JList with icons and text?
    By aneesahamedaa in forum AWT / Swing
    Replies: 2
    Last Post: 09-04-2008, 08:49 AM
  5. how to display strings on a video
    By dim_ath in forum New To Java
    Replies: 0
    Last Post: 05-03-2008, 10:10 AM

Tags for this Thread

Posting Permissions

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