• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inserting a video into graphics?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,Color.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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Will, welcome to the Ranch!

There may be a way to embed videos into a Java application, but if there is then (unfortunately) it isn't going to be an easy thing to do. So since you're new to Java and need a lot of help, that isn't going to be feasible. Even playing an MP3 is going to be out of range at the present time.
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic