How to prevent the automatic full-white repainting of an AWT Frame?

Using Java 1.6.0, Windows XP, 1.6.0-b105 Client VM I have the following problem:
I made a double buffered AWT frame. But it still flashes sometimes. It gives one flash about 6 seconds after start of application. There seems to be an incoming event "for no discernible reason". I have overridden all paint/repaint/update methods in my Frame sub class.
These unwanted flashes are caused by the AWT painting the frame in white and then calling paint.
I may have caught these weird calls:
The good/normal case looks like:
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1206)
at xed.xed_Frame.paint(xed_Frame.java:125)
at xed.xed_Frame.update(xed_Frame.java:119)
at sun.awt.RepaintArea.updateComponent(RepaintArea.java:239)
at sun.awt.RepaintArea.paint(RepaintArea.java:216)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
at java.awt.Component.dispatchEventImpl(Component.java:4486)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
The differences in the bad case: (Not all traces of this kind cause the flashing. But after all flashes there seems to be such a trace.)
at xed.xed_Frame.paint(xed_Frame.java:125)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
So how do I stop these unwanted white redraws of the Frame?

Accidentally found the answer:
System.setProperty("sun.awt.noerasebackground", "true");

Similar Messages

  • Sequence file Version number. How to prevent the automatic resetting build version number whilst auto-incrementing revision number?

    Hi,
    I've got my environment set this way that each save of the sequence file increase the revision part of version number. However, during that increase the build counter is reset to 0. How to prevent it?
    TS 4.2

    Mimi,
    It is pretty common practice in software revisioning to reset a minor number to 0 when a major moves up 1.  There are many different schemes out there.  If you google or bing software versioning schemes you'll see what I'm talking about.
    So looking at it from left to right:  Major.Minor.Revision.Build = 0.0.0.1 
    if you change the Revision it would be expected that anything to the right (in this case Build) would reset to 0.  0.0.1.0!
    Let's say your version is 8.34.56.23.  It would make sense that if you were to change the Major number (which means a Major release) to 9 then your version would go to: 9.0.0.0. 
    A version number is just a unique way to tell someone which specific software you are using so it really doesn't matter that it resets to 0.  Although it makes sense because if you kept your build number sequential and didn't reset it then it would get outrageously larger which would be more annoying than anything. 
    Again this is common accepted practice in industry.
    Good Luck,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Preventing the automatic download and installation of iOS 8

    Once again this becomes an issue. How to prevent the automatic download and installation of iOS 8. Thanks.

    Grrrrr. This needs a solution. I have a portable wifi account I use for teaching (mainly Apple devices) and when traveling. It updates my download capacity in 1gb chunks at $10 each. Just traveling at the moment, and this coincides with Apple updates. Three devices, @ 2 odd gb ea, all deciding to update while I drive. By the time I got the update notices from Optus, all three devices had downloaded the updates and were waiting for me to press install. I don't mind installing, but I don't want to pay $60 for the downloads thru this account. I think Apple owes me $60. There's no reason they can't set a restriction on this type of download for user nominated accounts. This is a significant issue for a lot of people. Please Apple,

  • How to prevent the Canon 6D to climb to higher ISOs when it works in automatic mode?

    How to prevent the canon from 6D climbing to higher ISOs when it works in automatic mode?
    I was shooting at a basketball game at ground level and I left it in automatic mode because the moves were too fast, but when I passed to Lightroom, the photos were grainy, due to high ISO.

    Under the settings menu (third menu over), select ISO settings, and then set the Auto ISO limits for max to whatever you consider the maximum acceptable ISO.

  • Does anyone know how to prevent the YouTube volume from going up automatically?  I keep my volume down and it increases automatically when I play a video.

    Does anyone know how to prevent the YouTube volume from going up automatically?  I keep my volume down and it increases automatically when I play a video.

    Have you tried Windows Update in the Control Panel?
    Many times it will find the newest supported drivers for Hardware.
    Just be sure to install everything not just the Important ones.
    Let us know if this helps.

  • How to prevent the user to submit leave request?

    Hi all,
    If the employee has wrong setup in the AME approval,the error "ERROR: An Invalid Setup has been detected for the current Transaction Type in Approvals" will be raised, although the employee will be able to submit the request, the request will have pending for approval status.
    How to prevent the user to submit the request when the error raised?
    Any idea.
    Regards

    Hi,
    Is this possible?  Pl check the error and your Transaction type. Refer ID 420381.1(How to Create the Approval Transaction Type for AME.A?) and also refer Oracle White paper on
    "Approvals Management Responsibilities and Setups in AME.B".
    Hope this helps.
    Regards,
    Siva

  • How to prevent the code viewing of jsp files

    hello friends
    How to prevent the code viewing on directly opening .jsp files at the server side
    Thanks in advance

    hello friends
    How to prevent the code viewing on directly opening
    .jsp files at the server side
    Thanks in advanceWhat exactly do you mean by code viewing? If by that you mean you don't want all the folders to show in the directory create a index.jsp file that has all the links to the pages you want to show
    If you mean something else please clarify

  • Hello , FMS is how to prevent the client into a large number of bytes?

    Hello , FMS how to prevent the client to pass a large number of bytes , such as one person put a 1G file in the argument , I also silly to receive ?Although there Client.setBandwidthLimit ( ) limit his maximum traffic per second , but is there a way , one more than the maximum amount of bytes to disconnect his.I assume that methods to determine the length is also obtained all of his transfer is finished , in order to determine out of it .

    How to limit the size of the parameters of the method.I wrote a method in the main.asc then the client NetConnection.call assignment, but if the client is malicious to upload very large data, how to limit it, I view the document did not find the clues, I hope that those parameters up to100KB.

  • How to use the set full screen mode ?

    hai...i' a newbie ..i hav one question ...how to use the set full screen mode for my application..
    i found.
    public void setfullscreenmode (boolean mode)
    but when try in my application it error and other
    canvas.setfullscreenmode(true);
    actually i don't know where i should put this code

    i also found the coding it use like
    setFullScreenMode (true);
    but when i apply it ..it error because cannot resolve the symbol.
    my question is which one i should use; declare the
    public void setFullScreenMode (boolean mode);
    first or use
    setFullScreenMode (true) ;
    or other way ..what i need to do to use setFullScreenMode

  • How to run the automatic RA run

    hi
    how to run the automatic RA run SO.
    sowmya
    Moderator: Please, avoid asking basic questions. On further violations your user will be banned

    You can schedule the job for Result analysis of SO. Transaction code is KKAK - Collective Processing. please check it. it may help you.

  • How to prevent the transaction code

    Hi
    I want to remove the common transaction code like /n,/o and /nex for particular user.
    Is there any SAP standard role availble or how to prevent the authurization for the above client independed
    transaction code.
    Regards,
    Jayakumar

    Hi,
    I want to know why you need to restrict these features when there is no harm.
    These are not transactions. They are extra features in SAP.
    /nT-code --- takes you to the new T-code by ending the previous T-code.
    /oT-code -
    creates a new session with the given T-code.
    /nex -
    ends the session.
    Rgds
    Suman

  • How to prevent the program not to skip the process when exception is genera

    Hi, friends.
    How to prevent the program not to skip the process when exception is generated?
    For example, I am doing a process for 100 records. If the 15th record causes a Java Exception, I want to be able to skip it and continue processing the remaining 85 records.
    How it is possible with Java Exception handling? Any sample code?
    Thanks,
    Jaykishan

    [http://java.sun.com/docs/books/tutorial/essential/exceptions/]
    while (there are more lines) {
      try {
        process the next line
      catch (...) {
        log the error
    }[http://java.sun.com/docs/books/tutorial/essential/exceptions/]
    You'll want to be careful about which exceptions you catch though. For instance, if there's an unchecked exception, like NullPointerException, it's a sign of a bug in your code. Continuing to process as if that bug weren't there is often a worse approach than just failing. In this particular case, however, as long as you log the exception and then followup by fixing the bug that caused it, it may be acceptable to continue trying to process the rest of the file, even if some lines bring out a bug in your code.

  • How do I turn off the automatic full screen feature that makes the top bar (with the minimize buttons) disappear?

    I just downloaded Firefox 4 on a Dell laptop with WinXP. When I'm in a browser window the window resizes automatically and the bar at the top (with the minimize, full and close buttons) disappears. When I drag the cursor up to the top the window resizes again and that top bar appears. Makes me crazy. How do I turn it off?

    I'm not aware of the behavior you're describing. I've never seen it, and just tested it for myself. I cannot get windows to zoom to full screen just from moving them to or along the top of the screen. Is this only happening in Photoshop? If so, it may be a Photoshop issue. If not, have you installed any kind of third-party software that might be doing that? Try rebooting in safe mode and see if the problem persists then. If it doesn't, but comes back when you reboot normally, the problem is caused by some third-party software you have installed.

  • How to remove the automatic option of saving in iCloud?

    Is there a way to change the automatic option of saving to iCloud when saving new documents in most of the applications in osx lion? Example: launch pages. Immediately a screen pops up that shows finder or the option to create new doc. (I also dislike this feature; would love to go back to launching pages and a blank page coming up or nothing happening at all, leaving me the option to do whatever I want rather than be told wha tthe options are). Create new doc. Then try to save. Then it tries to automatically save to iCloud. After having to click on a few places, I get where I want  I be. Unneeded work. How can I change options, to go back to how things used to be?
    Thanks

    To prevent saving in iCloud, go to System Preference/iCloud and uncheck the Documents & Data box. Now if you start any OS X app like TextEdit, it won't show that iCloud Dialog.

  • How to prevent JFileChooser automatically changing to parent directory?

    When you show only directories, and click on the dir icons to navigate, and then dont select anything and click OK, it automatically 'cd's to the parent folder.
    My application is using the JFileChooser to let the user navigate through folders and certain details of 'foo' files in that folder are displayed in another panel.
    So we dont want the chooser automatically changing dir to parent when OK is clicked. How to prevent this behavior?
    I considered extending the chooser and looked at the Swing source code but it is hard to tell where the change dir is happening.
    thanks,
    Anil
    To demonstrate this, I took the standard JFileChooserDemo from the Sun tutorial and modified it adding these lines
              // NEW line 45 in constructor
              fc.addPropertyChangeListener((PropertyChangeListener) this);
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          * NEW -
          * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
         public void propertyChange(PropertyChangeEvent e) {
              String prop = e.getPropertyName();
              if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
                   System.out.println("DIRECTORY_CHANGED_PROPERTY");
                   File file = (File) e.getNewValue();
                   System.out.println("DIRECTORY:" + file.getPath());
         }

    Here is the demo:
    package filechooser;
    import java.awt.BorderLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.io.File;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    * FileChooserDemo.java uses these files:
    *   images/Open16.gif
    *   images/Save16.gif
    public class FileChooserDemo extends JPanel implements ActionListener,
              PropertyChangeListener {
         static private final String newline = "\n";
         JButton openButton, saveButton;
         JTextArea log;
         JFileChooser fc;
         public FileChooserDemo() {
              super(new BorderLayout());
              // Create the log first, because the action listeners
              // need to refer to it.
              log = new JTextArea(5, 20);
              log.setMargin(new Insets(5, 5, 5, 5));
              log.setEditable(false);
              JScrollPane logScrollPane = new JScrollPane(log);
              // Create a file chooser
              fc = new JFileChooser();
              // NEW
              fc.addPropertyChangeListener((PropertyChangeListener) this);
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
              // Create the open button. We use the image from the JLF
              // Graphics Repository (but we extracted it from the jar).
              openButton = new JButton("Open a File...",
                        createImageIcon("images/Open16.gif"));
              openButton.addActionListener(this);
              // Create the save button. We use the image from the JLF
              // Graphics Repository (but we extracted it from the jar).
              saveButton = new JButton("Save a File...",
                        createImageIcon("images/Save16.gif"));
              saveButton.addActionListener(this);
              // For layout purposes, put the buttons in a separate panel
              JPanel buttonPanel = new JPanel(); // use FlowLayout
              buttonPanel.add(openButton);
              buttonPanel.add(saveButton);
              // Add the buttons and the log to this panel.
              add(buttonPanel, BorderLayout.PAGE_START);
              add(logScrollPane, BorderLayout.CENTER);
          * NEW -
          * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
         public void propertyChange(PropertyChangeEvent e) {
              String prop = e.getPropertyName();
              // If the directory changed, don't show an image.
              if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
                   System.out.println("DIRECTORY_CHANGED_PROPERTY");
                   File file = (File) e.getNewValue();
                   System.out.println("DIRECTORY:" + file.getPath());
         public void actionPerformed(ActionEvent e) {
              // Handle open button action.
              if (e.getSource() == openButton) {
                   int returnVal = fc.showOpenDialog(FileChooserDemo.this);
                   if (returnVal == JFileChooser.APPROVE_OPTION) {
                        File file = fc.getSelectedFile();
                        // This is where a real application would open the file.
                        log.append("Opening: " + file.getName() + "." + newline);
                   } else {
                        log.append("Open command cancelled by user." + newline);
                   log.setCaretPosition(log.getDocument().getLength());
                   // Handle save button action.
              } else if (e.getSource() == saveButton) {
                   int returnVal = fc.showSaveDialog(FileChooserDemo.this);
                   if (returnVal == JFileChooser.APPROVE_OPTION) {
                        File file = fc.getSelectedFile();
                        // This is where a real application would save the file.
                        log.append("Saving: " + file.getName() + "." + newline);
                   } else {
                        log.append("Save command cancelled by user." + newline);
                   log.setCaretPosition(log.getDocument().getLength());
         /** Returns an ImageIcon, or null if the path was invalid. */
         protected static ImageIcon createImageIcon(String path) {
              java.net.URL imgURL = FileChooserDemo.class.getResource(path);
              if (imgURL != null) {
                   return new ImageIcon(imgURL);
              } else {
                   System.err.println("Couldn't find file: " + path);
                   return null;
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event dispatch thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("FileChooserDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Add content to the window.
              frame.add(new FileChooserDemo());
              // Display the window.
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              // Schedule a job for the event dispatch thread:
              // creating and showing this application's GUI.
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        // Turn off metal's use of bold fonts
                        UIManager.put("swing.boldMetal", Boolean.FALSE);
                        createAndShowGUI();
    }

Maybe you are looking for