How do you keep the graphics on the screen with AWT?

Hi. I have been playing around with applets a lot lately and I keep coming to the same problem. Once the applet is loaded, if you draw something in it and then move another window in front of your applet the thing you originally drew disappears. I have been wondering how to avoid that problem for a while but I can't figure out how except to keep a bitmap or double array of color values for every pixel in the applet and then redraw the entire thing every few milliseconds. I also noticed that the same thing happens to java window panes, unless you use Swing. I found out about it pretty much yesterday (the fact that swing automatically refreshes the missing portion of the graphics), but I would prefer not to use swing unless it is really that big of an improvement. The reason being that I want to learn how they managed doing the refresh without using up massive amounts of your computer's concentration. Does anyone have an answer?

TheGrandGoblin wrote:
Hi. I have been playing around with applets a lot lately and I keep coming to the same problem. Once the applet is loaded, if you draw something in it and then move another window in front of your applet the thing you originally drew disappears.That's a bug (with your code).
I have been wondering how to avoid that problem for a while but I can't figure out how except to keep a bitmap or double array of color values for every pixel in the applet and then redraw the entire thing every few milliseconds.You don't have to do that.
When a component in a AWT or Swing GUI is made viewable (after having been uncovered as you describe, or being de-iconified, or at the program's request) then the GUI thread calls the paint() (or in Swing, paintComponent()) method.
Your program should provide a reasonable implementation of paint() or paintComponent().
I also noticed that the same thing happens to java window panes, unless you use Swing. I found out about it pretty much yesterday (the fact that swing automatically refreshes the missing portion of the graphics), So does AWT.
but I would prefer not to use swing unless it is really that big of an improvement. The reason being that I want to learn how they managed doing the refresh without using up massive amounts of your computer's concentration. Does anyone have an answer?This should have been covered in just about any introductory tutorial or book about AWT or Swing. I'm surprised you didn't see it. (Well actually maybe not. Sun is pushing Swing hard and as I recall they don't exactly make it easy to find AWT tutorials.)
Edited by: paulcw on Feb 6, 2008 7:08 PM

Similar Messages

  • How can you keep music in iTunes in sync with 2 Mac's?

    How can you keep music in iTunes in sync with 2 Mac's?

    There are some third party applications designed to do this. Have a look at this one for instance and see what you think: syncOtunes

  • How do you keep your users/groups in sync with latest developments?

    As there seems to be some reorganization happening with regards to the core system users and groups (with systemd develpment and whatnot) I feel somewhat uncertain about how I should set up my users, which are needed and so forth, seems every update of the filesystem package as of recent leaves me with changes to the users/groups in .pacnew files that needs careful merging to not screw up the system.
    There is of course https://wiki.archlinux.org/index.php/Users however this is usually outdated (it currently only has one systemd user while the most recent passwd has five). Last time I broke my system was when I tried to apply changes suggested by the wiki page, rather then trying to figure out the changes from the .pacnew files).
    Unfortunately I don't feel confident enough with the most recent changes to fix the wiki-page myself.
    Right now my method is rather ad-hoc, I read the .pacnew files and make some guesses as to what users/groups in my files were added by other packages and should be left alone, and what users/groups were deleted/changed/added from the actual filesystem package because of changes in for example how the lastest version of systemd works. As I've made wrong guesses before, I feel there might be a better way to deal with this.
    How do you do it?
    What are the best sources of updated information for what currently is the best practice way to set up the core system users/groups?

    I find it very helpful to know what has changed in the files from last update to the current, so I can see which of the differences to my files are from the package update and which are custom changes of other packages or myself. So I either compare a new *.pacnew file to the last one if I had saved it (what I do for some files), or I go and check the diff of the package update. To do that, I go to the package page for filesystem, click on View Changes under Package Actions, find the current version and follow its link. There one can see which files got what changes.
    For example the filesystem 2014.07-1 update had a change in the group file, input:x:97: got added, and also some changes in gshadow.
    Last edited by Sanne (2014-11-05 11:55:28)

  • How do you keep your place on the page

    we are trying to go paperless in my office, but the biggest complaint form the user is.
    "Hey when we did this on paper we never lost our place because we put a ruler under the line we were working on. We would stop printing if you can tell us how to to the EXACT same thing with the pdf's"
    to let you know they are looking at scanned imiages that have been locked. so even if i could get them to accept highliting (which they flat out rejected) it does not work with imiages.
    in practice what they really want is a way to throw up semi transpartent box, that would highlight where they currently were, that they could simply use the arrow keys to move up and down the page.
    Does adobe (reader of full) have any function close to this? does some one have a viable alternative? might there be an addon or plug in that achieves this?
    Thank you in advance for your help
    Kevin

    Thank you for the help.
    How ever since the documents are locked the commenting tools will not enable.
    as well that would not meet managements requirements. of Simple to move up and down the page like a ruler.

  • How do you keep iPhone charged while connected to carplay

    How do you keep iPhone charged in the car while it is connected to the cable for CARPLAY?

    The next time you connect your iPad to your laptop, click on your iPad under Devices and then click on the Apps tab on top. Once it opens and lists all your apps in iTunes on the left (both iPad and iPhone ), simply uncheck the boxes next to the iPhone apps you wish to leave off from future syncs. They will still be in iTunes and available for your iPhone, but won't be synced to your iPad. Click on Apply.

  • How can you keep your iPhone 4 (using it as my car's iPod) staying on the Audible app?  When I leave the car and return to continue hearing a book, it has switched to iTunes.

    How can you keep your iPhone 4 (using it as my car's iPod) staying on the Audible app?  When I leave the car and return to continue hearing a book, it has switched to iTunes.

    The first time an iPhone is connected to iTunes that is used to sync with another iPhone or iOS device, you are prompted to transfer the backup for the other iPhone or iOS device or to set up the iPhone as a new iPhone.
    The former does as provided - it transfers the backup for the other iPhone or iOS device to the iPhone replacing all data on the iPhone that is included with the backup being transferred. The latter does nothing allowing you to make your various selections for the iPhone sync preferences with iTunes.
    This is designed to be done right away with a new iPhone.
    If you don't have a backup for the iPhone with iTunes on your computer and don't have an iCloud backup that hasn't been updated since choosing to transfer the backup for your iPod Touch to the iPhone, the data that was on the iPhone is gone.

  • HT4489 this is ridiculous! how do you keep the size of the picture for a contact that small? it is usually a piece of  a lager picture... any way to make the size of the pictures the 224 KB they want? I always thought the application cropped the picture t

    this is ridiculous! how do you keep the size of the picture for a contact in the address book that small? it is usually a piece of  a lager picture... any way to make the size of the pictures the 224 KB they want? I always thought the application cropped the picture to fit their requirements...
    Help
    Leo

    Gem
    Events are organised strictly on date and time, as read by iPhoto from the Exif data in the Photo. You cannot manually sort.
    Create Albums. You can do much more organising with Albums, use Photos from different events, place them as you will. Best of all, Albums use no disk space at all. They simply reference the file on the Hard Disk. So a pic can be 1, 10 or 100 Albums with no wasted disk space whatever.
    Regards
    TD

  • HT4236 How do you keep photos in the same sequence on the iPhone that they are on the PC folder?

    How do you keep photos in the same sequence in the iPhone as they are in the folder on the PC??

    When I sync my photos they are listed alphabetically (by folder) and within the folders, listed alphabetically again by the name assigned to the photo. The only way I can think of to keep the order that you have in your computer would be to assign a letter as a prefix to each photo. If you have more than 26 photos in a folder, you can double the letters, etc. I think that will keep the photos in the order you want.

  • When burning a playlist to disc, how do you keep the songs in original order?

    When burning a playlist to disc, how do you keep the songs in original order?

    If you are burning an audio CD, they will burn in sequential order as in your playlist.
    If you are burning an MP3 CD or a data CD, they will burn as individual files, and can be sorted any way you like when you view the CD.  For an MP3 CD, the files will be prepended with a sequence number, so if you sort by filename, they will be in the original order.

  • Using a iPad.  How do you delete unwanted address from the drop down list.  I typed in a wrong address once, and now it keeps showing up.

    Using a iPad.  How do you delete unwanted address from the mail drop down list.  I typed in a wrong address once, and now it keeps showing up.

    Winfax1-
    Look in your Contacts App and see if the unwanted address is entered there.  If it is, you can delete it there.
    Fred

  • How do you keep the browser heading from showing?

    How do you keep the browser heading from showing in the
    output? I did this once but can't figure out how!
    Thanks in advance,
    Rosie

    You asked...
    quote:
    Is there a way to shrink the application you're capturing so it
    fits within a given capture window rather than requiring scrolling,
    or would I have to go back to the application developers for that?
    (I realize that would shrink the size of everything on the screen,
    but in some cases, that would be worth it to be able to show a
    window without scrolling.
    If, by "shrink" ... you mean by using the AppSizer, the
    answer is "not really". You can configure AppSizer to a defined
    size, then with the mouse pointer double-arrowed on the "edge" of a
    window, right-click and your window-size selections will appear in
    the AppSizer "list" (that you set up) and can be selected there.
    But there is no re-scaling of the window contents, if that is
    what you mean, so the smaller window may now require scrolling.
    But keep in mind that if you use the recording option for
    "Software Simulation" > "Custom Size", you can then snap the
    application window to that size...

  • Lightroom 5 make adjustments want to transfer to photo shop to make additional adjustments. how do you keep the adjustments made in lr5 when photo is transferred to photo shop

    lightroom 5 make adjustments want to transfer to photo shop to make additional adjustments. how do you keep the adjustments made in lightroom 5 when photo is transferred to photo shop
    I am not able to keep the changes made in light room when I transfer to photo shop

    Something you need to understand. Unless you are using the latest version of Photoshop Elements, it's possible that some of the adjustments that you make in Lightroom won't transfer to Elements if you choose the option to open anyway. If you choose the option to edit a copy with Lightroom adjustments then Lightroom will create a TIF or PSD file (depending on your preferences), and that file will include all of the adjustments that you have made using Lightroom. Then you can finish your work in Photoshop Elements.
    The process of transferring an image from Lightroom to Photoshop or Photoshop Elements involves the Camera Raw plug-in. It has to be used to interpret the Lightroom adjustments and apply those adjustments to the image after it has been converted. Files open in Elements or Photoshop or no longer raw images because those programs are incapable of editing raw image data. I don't know if this will help you in this situation. Feel free to ask if you have more questions.

  • HT3215 How do you keep the clock face showing all the time without the screen going dark?

    How do you keep the clock face showing all the time without the screen going dark?

    Thanks.  I saw a number of answers to the same basic question after I posted my question and apparently there are ways to to keep it on but, as you said, it will drain the battery quickly.

  • How can you keep the highest iphone 4s Video quality the same when exporting it from iMovie.

    How can you keep the highest iphone 4s Video quality the same when exporting it from iMovie.

    InDesign's PDF export engine does not transcode your videos, they are embedded exactly as they were in the original file. The Flash Player runtime which displays video inside PDF files may not show a perfect match to Quicktime etc. because most video playback tools aren't designed for a color-calibrated workflow, but they should be close.
    The playback quality (blocking and aliasing) will be affected if the clip is not playing at 100% (screen pixels != video pixels) and in PDFs with the standard video player widget, that will only ever happen when you use 'floating window' mode. PDF pages have physical dimensions, so viewing them at "100%" does not make them match screen pixels.
    If you don't mind the video clip being smaller than the media annotation in which it's playing, then use my free upgrade to the Acrobat playback widget - VideoPlayerX - which maintains 1:1 pixel scale until the page is zoomed out too far for it to fit. You can install the widget into InDesign so it's used by default when exporting.

  • How do you keep your ipod apps after updating to the 4.0 upgrade?

    I first backed up my iPod touch to keep all of my apps. Then I updated it to 4.0, when I got finished it didn't have any of my apps except the original ones from the iTouch. So I went to click restore from back up and it said that the 4.0 update would go away if I restored from backup. So how do I keep my apps and the update? I have bought some of the apps and do not think it would be fair to re buy them.

    No, a backup won't do anything, you need to check your sync settings and then re-sync.
    1- Connect your Touch to iTunes
    2- Verify that your App sync preferences are set correctly
    3- Verify that all your other sync preferences (Music, Video, Podcast) are set correctly
    4- Click Apply if you made any changes, or click Sync to initiate a sync w/o any changes.
    Assuming the missing Apps are in your iTunes, they should be added to your Touch after you re-sync.

  • When playing songs in iTunes playlist, How do you keep the next song from jumping to next song? I am working on song list updating other tracks info and then the next song starts and I lose my spot in song list?

    When playing songs in iTunes playlist, How do you keep the next song from jumping to next song? I am working on song list updating other tracks info and then the next song starts and I lose my spot in song list?

    Max OSX 10.6.8, iTunes 11.1
    I had a similar problem: I wanted to synch my playlist to my iphone. I like to have my playlist sorted by genre. But under each genre, albums are not sorted by the track numbers. This is a problem, especially when I am listening to club mixes when the DJ smoothly transitions from 1 track sequentially to the next one. Under the properties of each audio file, the Track Numbers and Disc Numbers are already there.
    My perfect solution was to turn On Sorting - Sort Album under View>Show View Options. Then, select all the songs in that album (Shift click, Cmd click, etc) , and Edit multiple item information (Cmd I). You will see Info-Video-Sorting-Options buttons. Click on Sorting. Then, under Sort Album, Enter the name of the album. Then OK.
    You should now have the playlist sorted by Genre, then each album individually sorted by track numbers. On your playlist you should see, if you scroll right, the column added called "Sort Album".
    Hope this helps.

Maybe you are looking for

  • ACS 5.3, delete local backup files.

    Hello. I'm doing a basic setup of ACS 5.3. For now, I'm configuring backup to a local repository repository Backup   url disk:/Backup How can I automatically delete old files? I need to keep only the last seven files. Thanks. Andrea

  • My IPad is deleting emails from server; how do I stop it?

    I have an IMac and an IPad; my wife has a Microsoft system. All are on a network with Apple router. Just in the last week or so, when I delete emails from my IPad, it deletes them from the ATT server, whether they have been read on the other machines

  • Cannot install apps from App Store after iOS 7.04 upgrade

    Hi everyone I am new to iPad and Apple, and wonder if someone can please help me with this problem. I upgraded to iOS 7.04 yesterday, and today I cannot install any new apps from the App Store. Before the upgrade I could do this no problem. The 2 app

  • Import photos from SD card into iPhoto

    Santa gave my wife a new camera for Christmas and I am trying to load photos from the SD card using the SanDISK MicroMate (plugs into USB port) that came with the card. My daughter also got a camera, a Digital Blue Disney micro that uses a cable to a

  • Java Programming Book:

    Does anyone know if there is/will be an update to the <u>Java Programming with the SAP Web Application Server</u> book anytime soon to cover the Composite Environment?