Displaying a matrix onto screen

hi guys, i'm trying to make a game. i'm going to load a two dimensional array with images and then display the whole matrix onto the screen and then add stuff to it like mouselistener.
static Object image[][] = new Object[300][300];
i only have a frame now. Can anyone teach me how to display the matrix?

If you know the 2D API, full screen mode only involves a few more method calls, and a switch to active rendering:
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
public class FlipExample extends Window {
    public static void main(String[] args) throws Exception {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        try {
            FlipExample w = new FlipExample();
            gd.setFullScreenWindow(w);
            w.animate();
        } catch(Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            gd.setFullScreenWindow(null);
            System.exit(0);
    private boolean quit = false;
    private BufferedImage orig;
    private int offset = 0, x, dx=2, y, dy=2, UBX, UBY;
    public FlipExample() throws IOException {
        super(new Frame());
        setIgnoreRepaint(true);
        addMouseListener(new MouseAdapter(){
            public void mousePressed(MouseEvent e) {
                if (e.getClickCount() > 1)
                    quit = true;
        orig = ImageIO.read(new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg"));
    public void animate() {
        createBufferStrategy(2);
        BufferStrategy bs = getBufferStrategy();
        UBX = getWidth()-orig.getWidth();
        UBY = getHeight()-orig.getHeight();
        for(int times=0; !quit && times<10000; ++times)
            render(bs);
    private void render(BufferStrategy bs) {
        Graphics2D g = (Graphics2D) bs.getDrawGraphics();
        g.fillRect(0, 0, getWidth(), getHeight());
        g.drawRenderedImage(orig, AffineTransform.getTranslateInstance(x, y));
        bs.show();
        x += dx;
        if (x<0 | x>UBX)
            dx *= -1;
        y += dy;
        if (y<0 | y>UBY)
            dy *= -1;

Similar Messages

  • Display ipad on computer screen

    I would like to display my ipad screen on my Promethean board through my school desktop computer.  I do not want my device jailbroken.  What is the safest and easiest way to accomplish this?

    Hi bloodswife,
    I use a program called Reflector to wirelessly display my iPad onto my desktop computer. I connect my computer to a projector so that my iPad screen can be displayed via projector to a screen or board on the wall. Much cheaper than buying an Apple TV to do this. And the device doesn't need to be jailbroken
    Hope this answers your question!
    ~Joe

  • Display a BufferedImage to screen

    Hi,
    There maybe an answer somewhere already, but I didn't see it.
    As I understand it, rendering can happen on different outputs. They
    can be screen, printer, or offscreen buffer. Each of these three has
    their own way of creating a Graphics object. If I have a BufferedImage
    (which seems a better way of storing an image if image manipulation
    is required a lot), how do I display it onto screen? Thanks.
    Xiang

    blah blah paint(Graphics g) {
        g.drawImage(bufferedImage, 0, 0, this);

  • Startup display not in full-screen

    After connecting my Macbook Pro with Retina to an external display, the start-up screen was not in full-screen anymore. But when the startup is complete, the display returns to full-screen. May I know how to fix this problem? Thank you in advance.

    Try double clicking in  the Toolbar.

  • Display image in full screen

    Hi everyone, I am a newbie for labview. I just wanna ask you about image display in labview. Now I can display one image in my front panel. I open the file path and display it. First thing I wanna do is that is it possible to display on monitor full screen not on front panel and second thing is that how can I display images in folder and display it about 2 seconds delay in between? Pls kindly help me.
    Thanks millions.
    Solved!
    Go to Solution.

    Hi there, 
    -I don't know whether the image full display can be possible or not, Any reason why you are asking for such requirement?
    -The other question about reading files in a folder and display for 2sec can be done like shown in image.
    -I've attached vi in lv 12 if needed.
    -Next time, please post your vision related queries in Machine vision Board.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13
    Attachments:
    Image_read_folder.vi ‏43 KB

  • Error Message is not displayed on the pop screen for chain end chain

    Hi,
    I have called a screen in one of the standard program using enhancmenets,
    and i had put validations using chain and end chain, but the error message is not displayed immediately on the screen
    but it is displaying as log , i want the error should come on the same screen and it should not allow till the correct values are entered , how to handle it
    regards
    afzal

    Hi,
    have you tried option "LIKE" with instruction MESSAGE.
    Example:MESSAGE ID '38' TYPE 'S' NUMBER 000 DISPLAY LIKE 'E' WITH 'My Message'.
    And instead of using a MESSAGE instruction, why to not use a popup ?
    Like using one of these function modules (for instance):
    TMS_BCU_POPUP_TO_CONFIRM
    POPUP_TO_CONFIRM_STEP
    POPUP_TO_DECIDE
    FC_POPUP_ERR_WARN_MESSAGE
    etc...
    If that does not work, perhaps it's your ehancement which is not the good one or perhaps you have use a second one.
    Regards
    Mickael

  • How can I set up Cinema Display as a main screen and leave my macbook pro as a second screen instead?

    How can I set up Cinema Display as a main screen and leave my macbook pro as a second screen instead?

    I learned that the Dock is positioned at the chosen edge of whatever Display is positioned farthest to that side.  E.g. for the Dock to be positioned on the right side of the Cinema Display (instead of the right side of the MacBook), the Cinema Display must be oriented (by dragging) to the right of the MacBook monitor on the "Arrangement" tab of the Displays Preference Panel.

  • Error when displaying a field on Screen with Table Control

    Hi,
    It is going to 'Dump' when I am trying to display data on the screen with the help of Table Control. From the dump, What I have observed is , there is a field 'ZTSV_FSRDATA-ANZFEHLER'. If this field has negative value, then it is going to 'Dump' saying that the length is not enough. If it has a positive value then it is working fine. But the type of the field in the Internal table & on the screen are same.
    Please help me to resolve this error.
    I am posting here the Dump message also:
    A conversion error occurred while the program was trying todisplay data on the screen.
    The ABAP output field and the screen field may not have the same format.
    Some field types require more characters on the screen thanin the ABAP program. For example, a date field on a screen needstwo characters more than it would in the program. When attempting to display the date on the screen, an error will occur that triggers the error message.
    Thanks,
    Sreenivas Reddy Maddi.

    Hi Sreenivas,
       Refer this thread:
    how to display negative values in a screen field of a screen
    Re: negative values not allowed
    Regards,
    Sampath

  • My 4th gen ipod touch has crashed, just displaying a dark blue screen.  It won't turn off or do anything.  Connecting it to the laptop does nothing either.  Is this common and any ideas??

    My 4th Gen ipod touch has crashed, just displaying a bark blue screen.  It will not turn off or respond to any buttons being pressed or held for a number of minutes.  Connecting to the laptop does not help either.  Has anyone had this happen on their i touch or have a solution??
    Thanks

    If not successful, try the remaining actions of:
    iOS: Not responding or does not turn on

  • I've broken my iPhone 4, my frontal display and the back screen so, I'd like to know how much is to change it ?

    I've broken my iPhone 4, my frontal display and the back screen so, I'd like to know how much is to change it ?

    The state of the warranty no longer matters since accidental damage itself voids the warranty.  Apple calls replacement due to damage an out-of-warranty replacement so there is no misunderstanding about that.  And they take it just a little further by saying if you try and repair it yourself, then they won't have anything to do with the iPhone ever again.  They are pretty emphatic about what they will and will not do in the way of replacing.
    You can, of course, take the iPhone to an Apple Authorized Repair Service and see if they will replace the screen and back and how much that would cost.  That way Apple will still deal with you if necessary.

  • I have a 17" Macbook pro with flickering red and cyan(blue) lines across the screen. The issue disappears temporarily when I tap on the computer, and the problem does not occur when I use external display or try to screen capture the problem.

    I purchased my Macbook (17") through a certified apple tecnition in August 2012, it was refurbished and the motherboard was completely replaced. I do a lot of photo editing, but I have been unable to do so because of the red vibrating lines that interrupt my screen. The issue disappears temporarily when I tap on the computer, and the problem does not occur when I use external display or try to screen capture the problem. I brought the computer back to the technition I purchased it from and he said that it was a problem with my fan, so I have two new fans but the issue is still occuring. He says he doesnt know whats wrong. Does anyone have any information on this issue?
    Here is an image of the issue
    http://www.flickr.com/photos/[email protected]/8884847081/

    I recommend having your Mac serviced by someone competent. A force sufficient to "blow apart" the fans was clearly excessive and may have damaged the display cable, as well as any number of other problems.
    Dust is properly cleaned with a vacuum, preferably one designed for computer service, and they are not cheap.
    Compressed air should never be used. It just blows dust everywhere, often into places where it can no longer be removed.

  • When receiving email, Thunderbird freezes and displays "Not Responding" in screen header. Adds popstate folder to account.

    I'm running Thunderbird 31.6.0 on Windows 8.1 with BitDefender 2013.
    PROBLEM:
    When getting email, Thunderbird freezes and displays "Not Responding" in screen header.
    When TB is closed then reopened, a popstate folder (popstate-1.dat) is added to account. A new popstate folder appears with each crash/freeze, and as long as they are not deleted, they pile up with unique numbers (popstate-1.dat, popstate-2.dat, etc.).
    (see attached screenshot)
    NOTE: I've included troubleshooting details below for all the fixes I tried, thinking it might be helpful to anyone who has a similar problem and is thinking about going down those paths. Ultimately, it seems that FIX ATTEMPT 5 is the winner.
    ==================================
    FIX ATTEMPT 1:
    Following the suggestion in this archived mozilla support post: https://support.mozilla.org/en-US/questions/1026288, I restarted Thunderbird in Safe Mode (Help > Restart with Add-Ons disabled...), checking the "Disable all add-ons" and "Reset toolbars and controls" and clicking "Make Changes and Restart" button.
    In Add-Ons Manager, BitDefender Toolbar now appears to be disabled.
    (see attached screenshot)
    But the problem persists.
    FIX ATTEMPT 2:
    Following the suggestion in this archived mozilla support post: https://support.mozilla.org/en-US/questions/1016811, I clicked Help > Troubleshooting Information > Show Folder button. This opens a File Explorer window for 3I58b9dq.default (this is the "profile" folder) which contains panacea.dat and folderTree.json files.
    I changed file names to panacea-changed.dat and folderTree-changed.json (rather than deleting them, in case I need to restore them), and I reopened Thunderbird.
    This did not solve the problem -- and, furthermore, the profile folder seems to have automatically generated new panacea.dat and folderTree.json files to replace those for which I changed the filenames.
    FIX ATTEMPT 3:
    Following the suggestion in this mozilla support post: https://support.mozilla.org/en-US/questions/1044774, I restarted Windows 8.1 in safe mode with networking enabled (using these instructions: http://www.howtogeek.com/107511/how-to-boot-into-safe-mode-on-windows-8-the-easy-way/.)
    TB does not crash when Windows runs in safe mode, but the aspect ratio of my display is distorted; everything's really big and stretched horizontally, and my two displays are mirrored rather than extended. Running Windows perpetually in safe mode is not the ideal fix.
    QUESTION 1: I understand that troubleshooting is supposedly done best in safe mode — What might I do in safe mode to diagnose the Thunderbird problem?
    FIX ATTEMPT 4:
    This article https://wiki.mozilla.org/Thunderbird:Testing:Antivirus_Related_Performance_Issues#Symptoms, suggests that problems with Thunderbird associated with BitDefender can be solved by uninstalling and re-installing BitDefender.
    Not really comfortable uninstalling and re-installing, I disabled Bitdefender (Settings button > Antivirus button > Shield tab > On-Access Scanning toggle Off) to see if that would work. It did not fix the problem.
    QUESTION 2: Would uninstalling BitDefender be any different than disabling it?
    FIX ATTEMPT 5:
    Create a Bitdefender Exclusion for the Thunderbird folder:
    Settings button > Antivirus button > Exclusions tab > Excluded files and folders link > Add button > navigate to Thunderbird folder (c:\users\username\appdata\roaming\thunderbird) > Both radio button > Add button > OK button
    THIS FIX DID THE TRICK! YAY!

    FIX ATTEMPT #5 above did the trick, and now I see that it was the chosen solution for a similar post of the same problem at https://support.mozilla.org/en-US/questions/1044774

  • How to display contact person full screen photo in making a call or receive call

    How to display contact person full screen photo in making a call or receive call

    Apple have removed the full screen contact image calling in 7.1, they come with default icon. Hope they bring back that option in next, you can also leave feedback @http://www.apple.com/feedback/

  • I need to connect my Imac 27'' (newest version) up to 3/4 monitors (all 40'' LCD tv's with VGA and HDMI connections) with extended display to all external screens, not duplicate images. Is this possible?

    i need to connect my Imac 27'' (newest version) up to 3/4 monitors (all 40'' LCD tv's with VGA and HDMI connections) with extended display to all external screens, not duplicate images. Is this possible?

    I would suggest you visit an Apple dealer, preferably an Apple Store if there's one in your city, and ask for assistance in determining what you need. The questions and issues you bring up are rather complex to address in a technical support forum and would be better addressed in person where you and the salesperson can ask questions back and forth to arrive at the optimal setup.
    Regards.

  • Apple macbook pro with retina display is having yellow screen problems in which screen is not perfectly white and is yellowish. More over the service frm apple's part is ridiculous as they have faulty spare part. Does ne1 hv email of senior person?

    Apple macbook pro with retina display is having yellow screen problems in which screen is not perfectly white and is yellowish. More over the service frm apple's part is ridiculous as they have faulty spare part. Does ne1 hv email of senior person?

    Apple service centre employee told me that they do not have this 14 day offer in India.
    And My mac book pro is taken in by Service centre people to run test etc and I will be informed the next day if they accept it as a fault or not ?
    I feeling ridiculously bad.

Maybe you are looking for