Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: I'm not sure how to initialize GraphicsDevice and Window

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I'm not sure how to initialize GraphicsDevice and Window

    Java keeps telling me that the variables have not been initialized and it won't let me run my applet unless they are. I have looked and looked and LOOKED for the answer and have found none. Please and Thank you!


    GraphicsDevice myDevice;
    Window CallofDuty; 
    myDevice.setFullScreenWindow(CallofDuty);




    and then I have a second question is there a way to load video into an applet?


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: I'm not sure how to initialize GraphicsDevice and Window

    Hello DotChris,

    Welcome to the Java Programming Forums

    Try:

    GraphicsDevice myDevice = null;
    Window CallofDuty = null; 
    myDevice.setFullScreenWindow(CallofDuty);
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: I'm not sure how to initialize GraphicsDevice and Window

    Yes you can play video in a Java applet. Take a look at the Java Media Framework.

    The Java Media Framework (JMF) is a Java library that enables audio, video and other time-based media to be added to Java applications and applets.
    Java SE Desktop Technologies - Java Media Framework API (JMF)

    Java Media Framework - Wikipedia, the free encyclopedia
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  4. #4
    Junior Member
    Join Date
    Jul 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I'm not sure how to initialize GraphicsDevice and Window

    omg *face smack* I never thought to put a null there doh! Thank you so much! Wow >.> it just seems so apparent now. But of course a new problem arises, it still won't load in full screen.


    The whole point of this program is to trick a game addicted friend that he's playing call of duty 4 what he DOESN'T know is that it's going to be a very clever rick roll/annoying program and i'm going to make it so he has to press something like the tilde sign to stop it, the only problem is I can't really continue if it doesn't load full screen lol(preferably undecorated).

    import java.awt.*;
    import java.applet.*;
    import java.awt.Image;
    import javax.swing.*;
    import java.awt.Frame;
     
    public class Test extends Applet {
     
    	private Image picture;
    	public void init() {
     
    		resize(800,600);
     
     
    		picture=getImage(getDocumentBase(),"CallofDuty.jpg");
     
    	}
     
    	public void paint(Graphics g) {
     
    	g.drawImage(picture,0,0,this);
     
    	}
     
    public static void ControlPanel()	{
    GraphicsDevice myDevice=null;
    Window CallofDuty=null;
     
    myDevice.setFullScreenWindow(CallofDuty);
    Last edited by DotChris; July 15th, 2009 at 09:22 AM.

Similar Threads

  1. Navigating from one window to another
    By visharaddhavle83 in forum AWT / Java Swing
    Replies: 2
    Last Post: August 6th, 2009, 07:55 AM
  2. Facing problem with open modeless dialog from modal window
    By Divya in forum Java Theory & Questions
    Replies: 1
    Last Post: May 14th, 2009, 03:18 AM