Cant seem to get memoryimagesource to work right

Ok ive been messing with memory image source for a while here.
at least 6 hour's and i cant seem to get it to work in fullscreen.
i have tryed it a few different ways and im getting errors no matter what i do.
i figured id search the web for a example of memoryimagesorce in fullscreen but i can't find any!!!
anyways im haveing problems with drawimage().
i have the blue bar poping back up in this one even though i set undecorated to true.
when i try to use bufferstrategy it was even worse it locked up my comp 2 time's
here my horribly buggy code so far.
anyone have a example of the right way to use memory image source in fullscreen.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class FStest6 extends Frame{
  // VARIABLES OR USED CLASSES
     DisplayMode D_Mode;
     Frame frame;
     int w,h;
     // MAIN
  public static void main(String[] args) {
      try {
   FStest6 test = new FStest6();// call constructor to begin 
   } catch (Exception e) {e.printStackTrace();}
   System.exit(0);
  // CONSTRUCTOR
  public FStest6(){
      GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
   GraphicsDevice device = env.getDefaultScreenDevice();
   if(device.isFullScreenSupported() == false){System.out.println(" Warning full screen is not supported "); }
   else{device.setFullScreenWindow(this);}
   GraphicsConfiguration gc = device.getDefaultConfiguration();
   frame = new Frame(gc);
   frame.setUndecorated(true);
   frame.setIgnoreRepaint(true);
   frame.setResizable(false);
   D_Mode = device.getDisplayMode();
   if (device.isDisplayChangeSupported() == false) {System.out.println(" warning display mode unsupported ");
   }else{
   D_Mode = new DisplayMode(640, 480, 32, 0);}
   show();
   w = getSize().width;
   h = getSize().height;
  try{
   int [] pixels = new int[w * h];
   DirectColorModel colorModel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF,0);
   MemoryImageSource source = new MemoryImageSource(w, h, colorModel, pixels, 0, w);
   source.setAnimated(true);
   source.setFullBufferUpdates(true);
   Image img = createImage(source);
   boolean going = true;long timer =0;
   while(going){
   if(timer > 9999999){going = false;System.out.println(" exiting loop ");}
   render(pixels,img,source);
  }catch (Exception e){e.printStackTrace();}
  frame.dispose();
public void render(int [] pixels,Image img,MemoryImageSource source){
   //Graphics g = img.getGraphics();
   int n =0;int col = 0;
   long t = System.currentTimeMillis();
   for (int x=0;x<640;x++){
    for (int y=0;y<480;y++){
     n = y*640 + x;
     if(col < 254){col ++;}else{col = 0;}
     pixels[n] = col;
   source.newPixels();
   //g.drawImage(img, 0, 0, null);
   System.out.println((System.currentTimeMillis()-t)/100f);
}//eof class

Now my code is painting exactly one time, the loop is going but nothing's happening. It should be displaying the different color lines moveing and changeing color.
Also ive come to a problem ive had before in the tutorial,
about not useing paint and update.
however thier should logically be a method like drawimage to use
or i should be able to use it. but its not doing anything.
the application window is drawn directly to the screen (active rendering).
This simplifies painting quite a bit, since you don't ever need to worry about paint events.
In fact, paint events delivered by the operating system may even be delivered
at inappropriate or unpredictable times when in full-screen exclusive mode.
Instead of relying on the paint method in full-screen exclusive mode, drawing code is usually
more appropriately done in a rendering loop:
public void myRenderingLoop() {
    while (!done) {
         Graphics myGraphics = getPaintGraphics();
         // Draw as appropriate using myGraphics
         myGraphics.dispose();
Such a rendering loop can done from any thread,
either its own helper thread or as part of the main application thread.
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class FStest11 extends Frame implements Runnable, KeyListener {
Image img;
int w,h;
int cx,cy;
boolean done;
public FStest11() {
    GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    setUndecorated(true);// knock out bars and stuff
    setIgnoreRepaint(true);// ignore automatic repaint.
    if (device.isFullScreenSupported()) {
    device.setFullScreenWindow(this);}
    if (device.isDisplayChangeSupported()) {
    device.setDisplayMode(new DisplayMode(640,480,16,0));}
    show();//show fullscreen.
    w = getSize().width;
    h = getSize().height;
    done = false;
    addKeyListener(this);
    //new Thread(this).start();
    run();
    public void run(){
    int [] pixels = new int[w * h];// create the array that we will use for the pixels that i alter myself
    DirectColorModel colorModel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF,0);// create are ARGB 32bit pixel colormodel
    MemoryImageSource producerobj = new MemoryImageSource(w, h, colorModel, pixels, 0, w);// create a new producer
    producerobj.setAnimated(true);//Changes this memory image into a multi-frame animation .
    img = createImage(producerobj);//create's image from specifyed producerobject thus img should be a producer
    // i could abstract this class and make the below into a abstracted method
    while (!done) {
    int n =0,rcol =0,gcol =50,bcol =101;
    //Graphics gfx = img.getGraphics();// ackk!!!! cant be used in this context
    for (int x=0;x<640;x++){
     for (int y=0;y<480;y++){
      n = y*640 + x;
      bcol ++;rcol ++;
      if(bcol >253){bcol =0;gcol ++;}
      if(gcol > 253){gcol = 0;}
      if(rcol > 253){rcol = 0;}
      pixels[n] = ( ((rcol &0xff) <<16)|((gcol &0xff) <<8)|(bcol &0xff) );  // draw some new pixels
    // this would be the render code but i cant get it to work like the tutorial says.
    Graphics g = this.getGraphics();
    producerobj.newPixels();
    g.drawImage(img, 0, 0, null);
    g.dispose();
    System.out.println(" in loop " );
public void keyReleased(KeyEvent e) {}
public void keyTyped(KeyEvent e) {}
public void keyPressed(KeyEvent e) {if (!done){ done = true;System.out.println(" keypressed " ); } // program exits on any key press
public static void main(String[] args) {
   System.out.println(" app " );
   new FStest11();
   System.out.println(" exit " );
   System.exit(0);
}

Similar Messages

  • HT1552 Im setting up a server with the port 25565 and im doing it with Port Map but the problwem is i cant seem to get it to work with my router. it goes through my macmini to the router and the expansion hardrive

    Im setting up a server with the port 25565 and im doing it with Port Map but the problwem is i cant seem to get it to work with my router. it goes through my macmini to the router and the expansion hardrive

    Im setting up a server with the port 25565 and im doing it with Port Map but the problwem is i cant seem to get it to work with my router. it goes through my macmini to the router and the expansion hardrive

  • I cant seem to get iphoto to work

    HI i needed to download i photo but i cant seem to open in after downloading the i photo library

    Can't read your mind and stating an abstract problem gives us nothing to work with
    What version of iPhoto? Of the OS? what has recently changed?
    To download iPhoto backup up your iphoto library and download from the App store
    To open it click on it in the Dock
    You can not "download" the iphoto library - it is only local to you - the Application is downloadable - the library is yours
    LN

  • Hi, I have hp dv7-3165dx and I cant seem to get it to work. My operating system is windows 7 64 bit.

    I have been trying to troubleshoot this problem 4 about a month now.  When I put a bluray dvd the screen reads "no disk in drive".  This message is the same response i get with diffrent players, hp mediasmart, cyberlink power dvd 10, arcsoft, and also with img burn. & a couple of others.  I also chaged my drive letters in disk management, because my optical drive originaly was set to the letter F: Now its letter E: , So, my drive letters are, (C computer (D recovery (E optical (F): hp tools. I also ran the microsoft fix it. reads same message no disk in drive.  I restored my computer, I updated my mediasmart software, also recoverd it from advance out of the box state, same thing I ran the revo program & reinstalled the mediasmart 3.1, no luck. I also did the regedit troublesoot recommended by microsoft. only to find that I dont have any higher or lower filters to delete. so I closed that up. I ran the cyberlink bluray 3D advisor and it passed, when i run the fix it tool by mats, it reads , disk in drve not found . drive has error but drive is ok, I also tried diskpart by command prompt & it reads no media in drive E: drive not ready. also uninstalled by devise manager no help there. reseated my drive by physically removing thr drive as instructed to the tee, no luck. My warranty is up but my pc has been sent back to hp twice when under warranty. so if they just replaced dvd drive in november does that mean i get warrenty on my drive for a year on the drive itself, imean if we cant troublshoot this problem ? HP services has been great to me and the forums awsome, I really hope we can solve this problem,  THANKS A MILLION.

    Hi there dvdiehl,
    Try downloading and running the print and scan doctor located here:
    http://h10025.www1.hp.com/ewfrf/wc/document?docnam​e=c03275041&cc=us&dlc=en&lc=en
    It can fix a lot on its own and if not give a better idea of what is going on.
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • I'm trying to create an applescript to install printers - cant seem to get it to work

    So I'm running 10.7and I'm trying to create an applescript to install printers.  I'm able to run the first command without issues but the other two keeps giving me error messages in applescript.
    I assume its because the other two commands have spaces?
    These are the commands I run when in Terminal:
    /usr/sbin/lpadmin -p CX560 -E -v lpd://CX560/print -P /Library/Printers/PPDs/Contents/Resources/en.lproj/US-Letter/CX560_V1.PPD -D FireStationCX560
    /usr/sbin/lpadmin -p CX560-WORD -E -v lpd://CX560/print -P /Library/Printers/PPDs/Contents/Resources/en.lproj/Xerox\ Color\ EX\ 550-560 -D FireStationCX560-WORD
    /usr/sbin/lpadmin -p Firestation-HP5200 -E -v lpd://firestation-lj5200 -P /Library/Printers/PPDs/Contents/Resources/HP\ LaserJet\ 5200.gz -D Firestation-HP5200
    This is the only command I can successfully run in AppleScipt:
    do shell script "/usr/sbin/lpadmin -p CX560 -E -v lpd://CX560/print -P /Library/Printers/PPDs/Contents/Resources/en.lproj/US-Letter/CX560_V1.PPD -D FireStationCX560"
    Mind you this is the first time I'm trying this out so please be patient.
    Thanks!

    First things, when you post about a script and/or any errors you are getting it is a good idea to include the scrtpt and the exact error message you are getting. Just makes it easier to try and help.
    You're right about the spaces being the problem. You need to double escape them. That is
    /usr/sbin/lpadmin -p CX560-WORD -E -v lpd://CX560/print -P /Library/Printers/PPDs/Contents/Resources/en.lproj/Xerox\\ Color\ EX\\ 550-560 -D FireStationCX560-WORD
    that should do it. If you;re still getting errors post bask with the error message.
    regards

  • Help! cant seem to get video chat working

    Hi can anyone help me as I'm going mad!
    trying to get a video chat going - text is fine and then invite my partner to chat and click on accept but then but we keep getting an error message up at both ends...
    there was a communication error during your chat
    did not receive a response from "my partner"
    other computer is a macbook pro 2.53 GHZ intel core 2 duo running os 10.5.5
    any suggestions/ideas/fixes greatly appreciated!

    Hi
    First have you set the Quicktime streaming setting, goto sys prefs/quicktime/streaming/streaming speed, set to 1.5mbps
    In ichats prefs click on video and change bandwidth limit to none.
    Restart iChat.
    And try me defcom1 .mac account.
    Tony

  • I've connected my device through a wifi network and i accidentally signed out my apple ID for imessage then when I signed back in i cant seem to get connected though my wifi connection is working just fine. can anybody help me?

    I've connected my device through a wifi network and i accidentally signed out my apple ID for imessage then when I signed back in i cant seem to get connected though my wifi connection is working just fine. can anybody help me?

    I am having the same problem with my ipod nano
    I have been trying since Xmas

  • My screensaver stopped working .. Cant seem to get it to start again..help??????

    my screensaver stopped working .. Cant seem to get it to start again..help??????

    Hello,
    Open Console in Utilities & see if there are any clues or repeating messages when this happens.
    Does it work when you try the Test button in ScreenSaver prefpane?

  • I am trying to create a signature with echosign. I cant seem to get to the right screen. Any ideas?

    I want to create my signature with Echosign, but I cant seem to get to the right screen. How can I either draw my signature or type it in? thanks.

    George, I respectfully disagree that it related to the document. All documents I receive have the same problem. Again, all I want is to have the options back under the “Place Signature” button to be able to type my signature or draw it. The only thing the button is currently letting me do is  in the screen print below.
    cid:[email protected]

  • Hi everyone for  about 2 weeks now i cant seem to get any search results with the mobile myspace app on ipod touch 4g i have tried clearing cookies and cache ,resetting ipod uninstalling and reinstalling but nothing seems to work any ideas?

    hi everyone for  about 2 weeks now i cant seem to get any search results with the mobile myspace app on ipod touch 4g i have tried clearing cookies and cache ,resetting ipod uninstalling and reinstalling but nothing seems to work any ideas?

    - Have you tried going to the developer's support website/contacting the developer?
    - Try a reset. It surs many ills and nothng is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.

  • Cant seem to get a seagate external drive to show up in finder when on the

    cant seem to get a seagate external drive to show up in finder when on the airport extreme base station. ver 7.5 using 10.6.2 any special setting to show it up in finder?

    I tested a FAT 32 drive and it will show up.
    Open your Hard Drive and look for your AirPort Extreme under the SHARED heading
    Click the AirPort Extreme icon and then click Connect As at the upper right of the window
    Your drive should appear
    If not, click anywhere on your open desktop so that the Finder menus appear at the top of the screen
    Click Finder, then click Preferences, then click the General tab
    Under the heading of "Show these items on the desktop", make sure there is a check mark next to "Connected Servers"

  • The outgoing call icon has just appeared in the menu bar at the top of the screen on my iPhone 5 and i cant seem to get   rid of it.

    The outgoing call icon has just appeared in the menu bar at the top of the screen (next to the wifi icon) on my iPhone 5 and no matter what i do i cant seem to get   rid of it.
    I have rebooted and and cleared all running apps and still on luck.
    The phone still works ok and i can make and receive calls.... any ideas on how to get rid of it?
    Thanks

    Here's what it looks like.
    Mine did the same, just randomly overnight

  • On the top left of my computer screen there are what look like the bottom half of small grey and white squares stacked on top of each other. They form a line about three inches long and I cant seem to get rid of them.  Is my computer dying or being hacked

    On the top left of my computer screen there are what look like the bottom half of small grey and white squares stacked on top of each other. They form a line about three inches horizontally along the top and they cover half of the regualr bar (so half of the apple sign int he corner is covered) and I cant seem to get rid of them.  Is my hardrive crashing or being hacked?

    I have never seen DEVELOP on the menu bar for Safari, hence my query regarding testing. 
    What OS are you using and what version of Safari?
    If you want to check your HDD, Open Disk Utilities>First Aid and run Verify and Repair.
    The only remedy that I can think of that may work is an OS reinstall.
    I seriously doubt that your MBP is being hacked.
    Ciao.

  • How do i reset my mac completely? I have parental controls and cant seem to get to time machine cause i bought the computer with parental controls on it and they did not have the password. How do i completely reset my macbook pro?

    how do i reset my mac completely? I have parental controls and cant seem to get to time machine cause i bought the computer with parental controls on it and they did not have the password. How do i completely reset my macbook pro?

    If you have a rescue email address (which is not the same thing as an alternate email address) on your account then the steps on this page will give you a reset link on your account : http://support.apple.com/kb/HT6170
    If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact Support in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps on this page to add a rescue email address for potential future use : http://support.apple.com/kb/HT5620
    Or, if it's available in your country, you could change to 2-step verification : http://support.apple.com/kb/HT5570

  • HT204291 I can't seem to get AirPlay to work on my iPads, works fine on my iPhones on the same network, any suggestions?

    I can't seem to get AirPlay to work on my iPad's, it works fine on my iPhone 5's on the same network, any suggestions?

    http://whirlpool.net.au/wiki/three_email
    Have you tried contacting your ISP for support? Can you confirm that the email is suppose to be over Port 110 and not 143, or 995/993?

Maybe you are looking for

  • Awful customer service experience over the phone this weekend

    @emaiya I'm sorry for your troubles. I have sent you a private message to assist you further.

  • MacBook Pro 8,2 - Enabling Intel GPU results in blank screen

    I am trying to install Arch on my MacBook Pro 8,2.  I've followed the wiki page, and I should note that I have successfully installed Arch on here before (about 4 months ago) and it worked then.  However, this time I have made several attempts and fa

  • Webi report error (BO 4.0)

    Hi All, I need your help, now m working on BO 4.0. While refreshing Webi report in BO 4.0, getting error: Database error: The SAP SSO authentication process will fail because the current user doesn't have an alias that matches system BM7CLNT100.. (IE

  • Bootcamp and WIndows 7 Pro 64 bit

    Hello, I've restored my system and got Boot Camp to make a partition the size of 150 GB. I try to install Windows 7 Pro 64 bit and I get the message that the BOOTCAMP partition cannot be installed because it's not an NTFS file system. Is there a way

  • Photoshop CS4 on Vista not seeing 4 gigs of RAM

    I am running Photoshop as part of the CS4 Suite on a bootcamped intel mac pro towers using Vista Business with 4 gigs of Memory. We are running in 32 bit mode because of the Apple screw up with Carbon 64 so that both sides of the house windows and ma