Fastest way to draw a grid

What is the best or quickest way to draw the walls on PacMan
Making the game pacman and wondering is there a fast way to draw the board...
instead of loads of lines saying
g.drawLine(......);

Uh, I was asking if there was another way...
fillrect/drawrect are the only other ways to do it
lol... and I've tried Graphics2D.How about drawOval or drawPolygon (doubt that)?
>
I was wondering if there was maybe another class/set
of functions... etc?You could drop down to some native library like DirectX or OpenGL or some such, but I don't know of any other way to paint the screen with Java. (but then, I'm certainly not a "screen painting" sorta guy, so take that for what it's worth)

Similar Messages

  • What is the ABSOLUTE FASTEST way to draw a point on a JFrame in Java?

    I am currently using:
    g.drawLine(x,y,x,y);with g being a Graphics object. Is there any faster way to draw a point in Java?

    Uh, I was asking if there was another way...
    fillrect/drawrect are the only other ways to do it
    lol... and I've tried Graphics2D.How about drawOval or drawPolygon (doubt that)?
    >
    I was wondering if there was maybe another class/set
    of functions... etc?You could drop down to some native library like DirectX or OpenGL or some such, but I don't know of any other way to paint the screen with Java. (but then, I'm certainly not a "screen painting" sorta guy, so take that for what it's worth)

  • Fastest way to draw Pixel at a time?

    so far, from what ive seen, an applet is fairly fast for creating and displaying images, im working with a fairly new shading method(its like a year old, which is fairly new compared to the other 4 or so shading methods), but this requires me to draw pixel at a time, im only drawing each pixel once(not drawing over the same pixel when drawing another shape) so everything is calculated before the pixels are set and drawn. the only way from which i can see with a standard graphics object i can see to draw a pixel(or a point) would be to draw a line with the same start and end point or to draw a rectangle with a width and lenght of 1 pixel(both of these methods for drawing a point are a little slower than i want them to be). ive tried using a Buffered Image in a JFrame, setting each pixel one at a time, then updating the frame to display the new image, but that has proven to be fairly slow, so is there any way(faster than using an applet) to draw pixels one at a time?

    what does the array parameter of setPixel in the WritableRaster class do?Depends on the type of buffered image you are using. I gave you an example of using a grey scale. 0 is black, 255 is white and you can have shades of grey in between.
    how can i use it to set the color i want? Above example doesn't help since you want more colors. So you would use a different type:
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);Now you need 3 entries in the array to specify the color. So to set a pixel red you would use:
    int[] pixelColor = new int[3];
    pixelColor[0] = 255;
    pixelColor[1] = 0;
    pixelColor[2] = 0;Here is a modified example that builds the image completely from an array:
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class ImageFromArray2 extends JFrame
         int width = 50;
         int height = 50;
         int imageSize = width * height;
         public ImageFromArray2()
              JPanel panel = new JPanel();
              getContentPane().add( panel );
              int[] pixels = new int[imageSize * 3];
              //  Create Red Image
              for (int i = 0; i < imageSize * 3; i += 3)
                   pixels[i] = 255;
                   pixels[i+1] = 0;
                   pixels[i+2] = 0;
              panel.add( createImageLabel(pixels) );
              //  Create Green Image
              for (int i = 0; i < imageSize * 3; i += 3)
                   pixels[i] = 0;
                   pixels[i+1] = 255;
                   pixels[i+2] = 0;
              panel.add( createImageLabel(pixels) );
              //  Create Blue Image
              for (int i = 0; i < imageSize * 3; i += 3)
                   pixels[i] = 0;
                   pixels[i+1] = 0;
                   pixels[i+2] = 255;
              panel.add( createImageLabel(pixels) );
         private JLabel createImageLabel(int[] pixels)
              BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
              WritableRaster raster = image.getRaster();
              raster.setPixels(0, 0, width, height, pixels);
              JLabel label = new JLabel( new ImageIcon(image) );
              return label;
         public static void main(String args[])
              JFrame frame = new ImageFromArray2();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible( true );
    }

  • Drawing float* buffer fastest way

    Hi,
    I am little out-of-date about pixel buffer objects, native pixel formats, etc. on OSX. Can you briefly point me out what is the fastest way to visualize grayscale data represented as float* 2d array (non power of two domain, [0,1] range) to the frame buffer? Is OpengGL my best option or is there any faster OSX specific direct frame buffer drawing?
    In case of OpenGL, how do I do this. I am using Cocoa, on 10.5x.
    Thanks a lot
    Sunil

    Hi,
    I am little out-of-date about pixel buffer objects, native pixel formats, etc. on OSX. Can you briefly point me out what is the fastest way to visualize grayscale data represented as float* 2d array (non power of two domain, [0,1] range) to the frame buffer? Is OpengGL my best option or is there any faster OSX specific direct frame buffer drawing?
    In case of OpenGL, how do I do this. I am using Cocoa, on 10.5x.
    Thanks a lot
    Sunil

  • Is there a way to draw gridlines at a specific point on a bubble chart?

    I'm using Xcelsius 4.5 and (trying to) creating a bubble chart.  I am using static min/max values for the x and y axes, but rather than drawing the gridlines in 1 or 2 divisions (i.e. the midpoint), I want to draw a grid line (both x and y) at a specific point -- is there any way to designate this point in Xcelsius?

    I figured it out - I just adjusted my formula to draw the min/max such that my intersection is always the midpoint

  • How to print the table values in fastest way?

    Dear Friends,
    I'm having table in my application and i need to print the table values. For that I used print() method to print the table values.
    boolean complete = tableObj.print(mode, header, footer, showPrintDialog, null, interactive,
                                  null);But, the time taken for displaying print dialouge box so late and printing operation is done very slowly.
    Could anyone please tell me is there any better way and fastest way to print the table values?
    Thanks in advance

    Hi,
    In the Module pool you will have fields. For those fields you have created the name also. Assign those name to work area and from there to internal table.
    And for your requirement viceversa you need to done.
    With Regards,
    Sumodh.P

  • What is the fastest way of getting data?

    With a scanning electron microscope, I need to scan a 512*512 pixel area with a pixel repetition of 15000 (two channels), meaning averaging over 15000 measurements. Simultaneously I have to adjust the voltage output for every pixel.
    I am using a 6111E Multifunction I/O board in a 800MHz P3. The whole task has do be done as fast as possible (not more than 20 minutes altogether).
    What is the fastest way to get this huge amount of data with averaging and output in between? (E.g. do I use buffered read with hardware triggering or is there a faster way?)

    Using the NI-DAQ API (not LabView) will give you a significant amount of more control over what happens and when to the data stream; which translates to a more efficient program. But you need to program in C/C++ or Delphi then. The Measurement Studio provides ActiveX controls that are like the LabView ones for C&C++ (they�re slow like the LabView ones though � not a lot you can do about the Windows GDI).
    What are you trying to sample 15000 times? The 512*512 pixel field?
    That�s almost 15Gigs of data! And it means you need to process data at 12.8MB/s to finish it in 20 minutes. I hope you know C, x86 assembly and MMX.
    I would setup a huge circular buffer (NI-DAQ calls them �double buffers�), about 30 seconds worth or so, to use with SCAN_Start. Then I would proces
    s the actual buffer the card is DMA�ing the data into with a high priority thread. Progressively sum the scan values from the 16bit buffer (the samples are only 12 bit, but the buffer should still be 16bits wide) into a secondary buffer of DWORDs the size of the screen (512*512), and you�ll need two of those, one for each channel. Once the 15000 scans are complete, convert each entry into a float divide by 15000.0f, and store it in a third buffer of floats.
    If you wish to contract this out, send me an email at [email protected]

  • Fastest way to transfer information from my old MacBook Pro to a new one?

    What is fastest way to transfer data between MacBook pros? It takes forever on wi-if.

    Sometimes the fastest way would be just to transfer only your files via a external hard drive via drag and drop methods into the same named accounts on the new machine. This is especially useful if you want to avoid corruption of the old machine and have a chance to clean house of older files.
    By the time one fiddles around finding a Firewire cable and adpaters, a standard USB 3 external hard drive could be done already and be gotten at any local computer or office store.
    Also Retina's have SSD's and any data on them is not scrubbable like hard drives can be. Scrubbing SSD's would involve the entire drive being filled and this would wear them out prematurely as they have limited writes to each sector.
    If you want to use Migration or Setup Assistant, there is some element of risk involved because your copying the corruption over from the previous machine if it exists. If you know the previous software is fine on the older machine, then you can use Carbon Copy Cloner to clone the whole OS X boot parititon to the external USB drive, then hook this up to the new machine and run Migration/Setup Assistant against it, just like you would in Firewire Target Disk Mode if you don't want to wait to get a Thunderbolt to Firewire adpater from Apple.
    If you already have the Thunderbolt to Firewire adapter and a cable/adpater to the old Mac, then that's the fastest way.

  • Fastest way to load a BufferedImage on a JPanel

    I am looking for the fastest way to display a BufferedImage on a JPanel.
    I am using JAI to take in photo files (JPG, BMP, GIF, TIFF, PNG) and create thumbnails (BufferedImage).
    I was reading through the forums and saw you can either
    1)overwrite the Graphics method or
    2)imageicon->JLabel->JPanel
    Currently, I am doing number 2, but I was wondering what the best way truly is.

    as you arn't doing any animation or that kind of thing, using Swing Components will work just fine.

  • Fastest way to create child class from parent?

    As the subject states, what do you folks find is fastest when creating child classes directly from the parent? (esp. when the parent is in a lvlib) I thought I'd post up and ask because the fastest way I've found to get working takes a few steps.
    Any suggestions ae appreciatized!
    -pat

    Thanks for the quick response Ben!
    Yea, I apologize, in your response I realize my OP was more than vague haha (it hapens when you get used to your own way of doing things I guess huh)- I'm trying to create a child from a parent so that it has all of the methods that the parent has.
    In order to do so I currently have to open and close LV a few times during my current process so that vi's in memory dont get mixed up- Currently I save a copy of the parent class in a sub dir of where it is saved, close out of LV, open the new 'copy of parent.lvclass', save as>>rename 'child class.lvclass', close LV, and open up the project to 'add file', then right click>>properties>>inheritance.
    Is this the only way to do this?
    Thanks again!
    -pat
    p.s. I'm tempted to steal your cell phone sig, hope you dont mind haha good stuff!

  • Fastest Way To Create Ultrabeat Instrument From Wav Loop?

    Hello, can anyone share the fastest way to create and instrument from a WAV file?
    I know you can convert a wav to ESX24 instrument but I use Ultrabeat not ESX.
    Im finding my self divinding each shot into region and then exporting that to its own file.
    Is there a faster/simpler way?
    -Thanks

    You're right! It does work, however, if you follow these steps:
    1. Right-click on wave file in Arrange and choose "Slice at Transient Markers" or use the corresponding key command.
    2. Select all the split regions right-click on them and choose: Convert > Convert to new audio file(s)
    3. Again, with all the regions selected choose: Convert to new sampler track.
    4. Now launch Ultrabeat. Click on the Import button anc choose the .exs file you've just created (will be located in your project folder). Then drag the audio files into UB as desired.
    You could skip Part 3 altogether and simply slice at transients, convert to new audio file(s) and then in a new kit of UB drag them into the sample window of OSC for each part...

  • Fastest way to create subtitles

    Hi! What is the fastest way to create subtitles. I have a short film with one hundred subtitles. I have a text list with time codes, can I use that somehow? Or do I have to enter every subtile separately? And what are the basic settings?

    A possibility seems to be using Quicktime Pro to add your text to a Quicktime movie. The Apple instructions are in Text Track Tutorial. I never used it in real life,... but I tested it in the past and it seemed to be doing what I expected: to layout text over an existing movie at preassigned timecodes...
    For sure you must first adapt your text and timecodes to the required format, and most of all you must have the "original" timecode in your movie untouched (all timecodes your text is making reference to). But if you edited and exported your movie from FCE you lost the original timecodes... so I'm not sure this may help you.
    The other approach is manual: in FCE add a text clip at the correct timecodes, one at the time...
    Piero

  • Fastest way to create buttons from TOC entries?

    I am trying to make a TOC interactive by applying rollovers and links to each entry. What is the fastest way to create buttons out of each entry? Would the "create outlines" command be appropriate? As it stands now, I am copying an entry, pasting it into a new frame, aligning it over the original entry, then converting to button and applying behaviors. There's got to be a more efficient way to do this!
    Using CS3 Design Standard.
    Thanks for any help you can provide.

    Matt,
    function(){return A.apply(null,[this].concat($A(arguments)))}
    Sorry about the attachment. Not sure what happened
    See
    Announcement: File Attachments temporarily disabled
    above. The "temporarily" was an understatement at the time -- this has been in effect for, what? the past 2 years? Now it's just a poignant Daily Reminder of Jive's many shortcomings.

  • Fastest way to create a track of Whole notes beginning to end

    I am trying to create a tapper track consisting of a series or low G (G2) whole notes.
    What is the fastest way of doing this. (they really should be quantized) And, they should also be on beat-one only, throughout an occasional meter change.
    In logic you could drag blocks. I realize I could simply loop and then convert loop to real midi...
    But.. would this run amuck with meter changes. (Remember I just want notes beginning on beat one, and ONLY beat one.
    -Thanks

    Where you have sig changes, copy the region, and adjust it's length to fit the meter … you only need 1 region, rather than try to anticipate the myriad of time sigs that may crop up.
    I understand exactly what you mean, and it makes a lot of sense. I think it's strictly a question of the pattern of usage. If his style when writing is to frequently throw in some odd time sig that he hasn't used much before and is not likely to use again anytime soon, then what you say seems like the best approach. On the other hand, I'm assuming he's more in a situation where he tends to throw in, say, a measure of 2/4, 3/4 or 5/4 every now and then. And it's just a few sigs like that which he tends to use frequently. Therefore it might be slightly easier to have a few regions like that already prepared, and in a place where I can grab them easily. If I have them marked clearly by name and color, I can feel comfortable that I'm avoiding an error. Whereas if I'm creating them over and over again each time I need one, the snap settings and zoom level are relevant, and it's a little too easy to make a careless mistake, if the phone rings at the wrong time.
    Also, he sometimes wants whole notes, and sometimes quarter notes. And maybe there are some other variations like this. This would also be a reason to have some material prepared that I can use over and over again.
    But of course if one day I decide to emulate Stockhausen and throw in a bar in 142/8 time, it makes sense to create that only when I need it, because if I create that region in advance it probably won't get used much.
    So in practice I could picture him doing it a combination of both ways, because chances are certain sigs are used often and others are used rarely. I think it really depends on the writing style, and the pattern of how the unusual sigs are distributed. And also if he sees an advantage in the marking by color. That could be considered helpful, or it could be considered ugly and distracting.

  • Fastest way to create a group from list of recived emails

    I thought this would be as easy as drag and drop but no such luck.
    Here's the situation.  I had a class of 25 students email me from their mobile phones all using the same subject.  Now I'd like to create a mailing list / group so that I can easly contact all of them if need be.  I tried creating a new group and dragging all of the emails into it to no avail.  I also tried right clicking and checking the menus to see if there were any options which there weren't.
    Anyone have any suggestions?  I'd be open to using automator or something similar if it worked.
    Thanks,
    Greg

    I think the fastest way to do this is in Mail>Message>Add to Address Book, then in AB>File>New Smart Group>Card:>Was updated After... say yesterday, then select all those & make a new (not Smart) Group to drag them to so it won't change after that.
    Unless you could get them all to eMail with some other unique that AB can see as a Group field.

Maybe you are looking for

  • Issue when transport request of Text Control

    Dear Gurus, I have some problem when modified Text controls. Requirement My customer want to copy item text from Quotation which is use access sequence 9000 to item text in Sale Order What I do. 1. I go to SPRO -> Sale and Distubution -> Basic Functi

  • ITunes Won't Open After Upgrading

    I have tried everything mentioned in the other threads but nothing seems to work for me. Everytime I open itunes it would show the hour glass then the hour glass would just go away and nothing happens, when i check my task manager, itunes is running

  • What is my iMacs network domain or name?

    I am trying to connect to a PC through a router. I read somewhere that the PC and iMac have to have the same domain name. The PC domain name is "WORKGROUP". I seem to remember seeing the iMac's domain name when I was setting up the computer, but I ca

  • How to find out SC's under DC's

    Hello, I wanted to know whether there is any easy way to find SC's under DC's. We had to find out under which component does com.sap.security.api.sda exists. We used SDM and tried each and ever component and finally found out it exists in SAP-JEECOR.

  • Web Elements in Crystal Reports on BOE XIr2

    <p>Hi</p><p>I am trying to set up my crystal report with multiple web elements controls and had a few questions.  Any assitance would be appreciated:</p><p>1) I have set up a radio button control and two drop down controls in my report.  When I post