Java Component setDoubleBuffered(boolean doubleBuffer, Component component)

Here you can find the source of setDoubleBuffered(boolean doubleBuffer, Component component)

Description

Modify the state of the double buffering on the component.

License

Apache License

Parameter

Parameter Description
doubleBuffer The new state of double buffering
component The component for which we want to change the state of double buffering

Declaration

static void setDoubleBuffered(boolean doubleBuffer, Component component) 

Method Source Code

//package com.java2s;
/*/*w ww  .jav  a2  s  . c om*/
 * Copyright JTheque (Baptiste Wicht)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import javax.swing.RepaintManager;

import java.awt.Component;

public class Main {
    /**
     * Modify the state of the double buffering on the component.
     *
     * @param doubleBuffer The new state of double buffering
     * @param component    The component for which we want to change the state of double buffering
     */
    static void setDoubleBuffered(boolean doubleBuffer, Component component) {
        RepaintManager currentManager = RepaintManager.currentManager(component);
        currentManager.setDoubleBufferingEnabled(doubleBuffer);
    }
}

Related

  1. setDoubleBufferedRecursively(final Component component, final boolean doubleBuffered)
  2. setNotBuffered(Component c)