Results 1 to 2 of 2
  1. #1
    vy2005 is offline Member
    Join Date
    Feb 2014
    Posts
    1
    Rep Power
    0

    Default Inserting a video into graphics?

    So I'm doing a project for my CS class where we have to create a snowman doing something. My picture is of Vince Young in the 2005 Rose Bowl. I'm trying to make the actual video clip from Youtube (do I need to download it? If so I can do that) appear on the scoreboard, but have no idea how. I'm completely open to suggestions. As of right now, this is my background file:

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Font.*;
    class snowBackground
    {
    public static void drawField(Graphics g, Color field)
    {
    Color sky = new Color(95,166,243);
    g.setColor(field);
    g.fillRect(0,300,1000,350);
    g.setColor(sky);
    g.fillRect(0,0,1000,300);
    g.setColor(Color.white);
    g.fillRect(50,300,15,350);
    g.fillRect(150,400,15,90);
    g.fillRect(250,400,15,90);
    g.fillRect(350,400,15,90);
    g.fillRect(450,400,15,90);
    g.fillRect(550,300,15,350);
    g.fillRect(530,540,15,70);
    g.fillRect(570,540,30,70);
    g.setColor(field);
    g.fillRect(580,557,10,30);
    g.setColor(Color.white);
    g.fillRect(650,400,15,90);
    g.fillRect(750,400,15,90);
    g.fillRect(850,400,15,90);
    g.fillRect(950,400,15,90);
    }
    public static void scoreboard(Graphics g)
    {
    Color numbers = new Color(224,199,52);
    Color gray = new Color(22,22,22);
    Color lightGray = new Color (131,131,131);
    g.setColor(gray);
    g.fillRect(320,250,20,50);
    g.fillRect(540,250,20,50);
    g.fillRect(315,50,250,200);
    g.setColor(lightGray);
    g.fillRect(345,210,25,25);
    g.fillRect(510,210,25,25);
    g.setColor(numbers);
    Font f = new Font("Dialog",Font.PLAIN, 18);
    g.setFont(f);
    g.drawString("33",347,230);
    g.drawString("38",512,230);
    Font h = new Font("Dialog",Font.PLAIN, 10);
    g.setFont(h);
    g.drawString("Texas",343,210);
    g.drawString("USC",511,210);

    }
    }

    and this is the Driver file (not sure if this is necessary):


    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Font.*;
    public class SnowDriverWSB
    {
    public static void main(String args[])
    {
    GfxApp gfx = new GfxApp();
    gfx.setSize(1000,650);
    gfx.addWindowListener(new WindowAdapter() {public void
    windowClosing(WindowEvent e) {System.exit(0);}});
    gfx.show();
    }//void main
    }//SnowDriverWB
    class GfxApp extends Frame
    {
    public void paint(Graphics g)
    {
    int xCoor=350;
    g.setColor(Color.red);
    g.drawOval(350,350,10,10);
    Color burntOrange=new Color(236,112,51);
    Color cardinal = new Color(211,24,24);
    Color gold = new Color(236,232,51);
    Color footballGreen = new Color(71,150,73);
    snowBackground.drawField(g,footballGreen);
    snowBackground.scoreboard(g);
    Snowperson vince = new snowFootball(150,350,200,200);
    vince.drawSnowperson(g,burntOrange,Color.white,Col or.black,10);
    Snowperson usc = new uscFootball(550,350,200,200);
    usc.drawSnowperson(g,cardinal,gold,gold,31);
    drawGrid(g);
    g.setColor(Color.blue);
    }
    public static void drawGrid(Graphics g)
    {
    g.setColor(Color.black);
    for (int x = 0; x<1024;x+=20)
    g.drawLine(x,0,x,768);
    for (int y=0;y<768;y+=20)
    g.drawLine(0,y,1024,y);
    }

    }

    There are 3 other files that make the actual Snowmen. To do this, I need VERY basic steps, as I'm extremely confused and new to Java. Also, would I need to download the mp3 sound file seperately and play that, or will inserting the video do both? Any replies are appreciated.

  2. #2
    kaydell2 is offline Senior Member
    Join Date
    Dec 2012
    Posts
    107
    Rep Power
    0

    Default Re: Inserting a video into graphics?

    I was unable to compile your code. Will you provide a short, self-contained, correct, compileable example (SSCCE)?

    Short, Self Contained, Correct Example

Similar Threads

  1. Centering graphics on the graphics window
    By janyc71876 in forum New To Java
    Replies: 5
    Last Post: 11-25-2013, 07:25 PM
  2. making packets of video and then video of packets
    By Sardar Najam in forum Networking
    Replies: 0
    Last Post: 03-05-2013, 11:43 PM
  3. Drawing a graphics onto another Graphics ?
    By Ziden in forum Java Applets
    Replies: 0
    Last Post: 01-08-2011, 07:30 PM
  4. Inserting Nodes
    By myst in forum New To Java
    Replies: 2
    Last Post: 07-12-2010, 04:26 PM
  5. Graphics: Buffered Array as Video Memory
    By TiagoCT in forum Java 2D
    Replies: 2
    Last Post: 11-11-2009, 01:34 PM

Posting Permissions

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