javax.swing

Class RepaintManager


  • public class RepaintManager
    extends Object
    This class manages repaint requests, allowing the number of repaints to be minimized, for example by collapsing multiple requests into a single repaint for members of a component tree.

    As of 1.6 RepaintManager handles repaint requests for Swing's top level components (JApplet, JWindow, JFrame and JDialog). Any calls to repaint on one of these will call into the appropriate addDirtyRegion method.

    • Constructor Detail

      • RepaintManager

        public RepaintManager()
        Create a new RepaintManager instance. You rarely call this constructor. directly. To get the default RepaintManager, use RepaintManager.currentManager(JComponent) (normally "this").
    • Method Detail

      • currentManager

        public static RepaintManager currentManager(Component c)
        Return the RepaintManager for the calling thread given a Component.
        Parameters:
        c - a Component -- unused in the default implementation, but could be used by an overridden version to return a different RepaintManager depending on the Component
        Returns:
        the RepaintManager object
      • currentManager

        public static RepaintManager currentManager(JComponent c)
        Return the RepaintManager for the calling thread given a JComponent.

        Note: This method exists for backward binary compatibility with earlier versions of the Swing library. It simply returns the result returned by currentManager(Component).

        Parameters:
        c - a JComponent -- unused
        Returns:
        the RepaintManager object
      • setCurrentManager

        public static void setCurrentManager(RepaintManager aRepaintManager)
        Set the RepaintManager that should be used for the calling thread. aRepaintManager will become the current RepaintManager for the calling thread's thread group.
        Parameters:
        aRepaintManager - the RepaintManager object to use
      • addDirtyRegion

        public void addDirtyRegion(JComponent c,
                          int x,
                          int y,
                          int w,
                          int h)
        Add a component in the list of components that should be refreshed. If c already has a dirty region, the rectangle (x,y,w,h) will be unioned with the region that should be redrawn.
        Parameters:
        c - Component to repaint, null results in nothing happening.
        x - X coordinate of the region to repaint
        y - Y coordinate of the region to repaint
        w - Width of the region to repaint
        h - Height of the region to repaint
        See Also:
        JComponent.repaint(long, int, int, int, int)
      • addDirtyRegion

        public void addDirtyRegion(Applet applet,
                          int x,
                          int y,
                          int w,
                          int h)
        Adds applet to the list of Components that need to be repainted.
        Parameters:
        applet - Applet to repaint, null results in nothing happening.
        x - X coordinate of the region to repaint
        y - Y coordinate of the region to repaint
        w - Width of the region to repaint
        h - Height of the region to repaint
        Since:
        1.6
        See Also:
        JApplet.repaint(long, int, int, int, int)
      • getDirtyRegion

        public Rectangle getDirtyRegion(JComponent aComponent)
        Return the current dirty region for a component. Return an empty rectangle if the component is not dirty.
      • markCompletelyDirty

        public void markCompletelyDirty(JComponent aComponent)
        Mark a component completely dirty. aComponent will be completely painted during the next paintDirtyRegions() call.
      • markCompletelyClean

        public void markCompletelyClean(JComponent aComponent)
        Mark a component completely clean. aComponent will not get painted during the next paintDirtyRegions() call.
      • isCompletelyDirty

        public boolean isCompletelyDirty(JComponent aComponent)
        Convenience method that returns true if aComponent will be completely painted during the next paintDirtyRegions(). If computing dirty regions is expensive for your component, use this method and avoid computing dirty region if it return true.
      • toString

        public String toString()
        Returns a string that displays and identifies this object's properties.
        Overrides:
        toString in class Object
        Returns:
        a String representation of this object
      • getOffscreenBuffer

        public Image getOffscreenBuffer(Component c,
                               int proposedWidth,
                               int proposedHeight)
        Return the offscreen buffer that should be used as a double buffer with the component c. By default there is a double buffer per RepaintManager. The buffer might be smaller than (proposedWidth,proposedHeight) This happens when the maximum double buffer size as been set for the receiving repaint manager.
      • getVolatileOffscreenBuffer

        public Image getVolatileOffscreenBuffer(Component c,
                                       int proposedWidth,
                                       int proposedHeight)
        Return a volatile offscreen buffer that should be used as a double buffer with the specified component c. The image returned will be an instance of VolatileImage, or null if a VolatileImage object could not be instantiated. This buffer might be smaller than (proposedWidth,proposedHeight). This happens when the maximum double buffer size has been set for this repaint manager.
        Since:
        1.4
        See Also:
        VolatileImage
      • setDoubleBufferMaximumSize

        public void setDoubleBufferMaximumSize(Dimension d)
        Set the maximum double buffer size.
      • getDoubleBufferMaximumSize

        public Dimension getDoubleBufferMaximumSize()
        Returns the maximum double buffer size.
        Returns:
        a Dimension object representing the maximum size
      • setDoubleBufferingEnabled

        public void setDoubleBufferingEnabled(boolean aFlag)
        Enables or disables double buffering in this RepaintManager. CAUTION: The default value for this property is set for optimal paint performance on the given platform and it is not recommended that programs modify this property directly.
        Parameters:
        aFlag - true to activate double buffering
        See Also:
        isDoubleBufferingEnabled()
      • isDoubleBufferingEnabled

        public boolean isDoubleBufferingEnabled()
        Returns true if this RepaintManager is double buffered. The default value for this property may vary from platform to platform. On platforms where native double buffering is supported in the AWT, the default value will be false to avoid unnecessary buffering in Swing. On platforms where native double buffering is not supported, the default value will be true.
        Returns:
        true if this object is double buffered

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/RepaintManager.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut