javax.swing.RepaintManager.isDoubleBufferingEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中javax.swing.RepaintManager.isDoubleBufferingEnabled方法的一些代码示例,展示了RepaintManager.isDoubleBufferingEnabled的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepaintManager.isDoubleBufferingEnabled方法的具体详情如下:
包路径:javax.swing.RepaintManager
类名称:RepaintManager
方法名:isDoubleBufferingEnabled

RepaintManager.isDoubleBufferingEnabled介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public class HTMLPrinter implements Printable{
  private final JEditorPane printPane;

  public HTMLPrinter(JEditorPane editorPane){
    printPane = editorPane;
  }

  public int print(Graphics graphics, PageFormat pageFormat, int pageIndex){
    if (pageIndex >= 1) return Printable.NO_SUCH_PAGE;

    Graphics2D g2d = (Graphics2D)graphics;
    g2d.setClip(0, 0, (int)pageFormat.getImageableWidth(), (int)pageFormat.getImageableHeight());
    g2d.translate((int)pageFormat.getImageableX(), (int)pageFormat.getImageableY());

    RepaintManager rm = RepaintManager.currentManager(printPane);
    boolean doubleBuffer = rm.isDoubleBufferingEnabled();
    rm.setDoubleBufferingEnabled(false);

    printPane.setSize((int)pageFormat.getImageableWidth(), 1);
    printPane.print(g2d);

    rm.setDoubleBufferingEnabled(doubleBuffer);

    return Printable.PAGE_EXISTS;
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
public boolean isDoubleBufferingEnabled() {
  return delegate.isDoubleBufferingEnabled();
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc}
 */
public boolean isDoubleBufferingEnabled() {
  return delegate.isDoubleBufferingEnabled();
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
@Override
public boolean isDoubleBufferingEnabled() {
  return delegate.isDoubleBufferingEnabled();
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
@Override
public boolean isDoubleBufferingEnabled() {
  return delegate.isDoubleBufferingEnabled();
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * {@inheritDoc}
 */
@Override
public boolean isDoubleBufferingEnabled() {
  return delegate.isDoubleBufferingEnabled();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf

/** {@inheritDoc} */
@Override
public boolean isDoubleBufferingEnabled() {
  return manager.isDoubleBufferingEnabled();
}

代码示例来源:origin: edu.toronto.cs.savant/savant-core

@Override
public boolean isDoubleBufferingEnabled() {
  return realManager.isDoubleBufferingEnabled();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Creates a new instance of AsyncInitComponent
 * @param comp4Init Component to be initialized. Mustn't be showing at this
 * time. IllegalStateException is thrown if component is already showing.
 * @param initJob Instance of initialization job.
 */
public AsyncInitSupport(Component comp4Init, AsyncGUIJob initJob) {
  this.comp4Init = comp4Init;
  this.initJob = initJob;
  if (comp4Init.isShowing()) {
    throw new IllegalStateException(
      "Component already shown, can't be inited: " + comp4Init
    );
  }
  Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.PAINT_EVENT_MASK);
  comp4Init.addHierarchyListener(this);
  if (!RepaintManager.currentManager(comp4Init).isDoubleBufferingEnabled()) {
    //We're running with hardware double buffering - cannot rely on an
    //AWT PaintEvent to start the job running - on mac, it will never come
    timer = new Timer (20, this);
    timer.start();
  }
}
Timer timer = null;

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Creates a new instance of AsyncInitComponent
 * @param comp4Init Component to be initialized. Mustn't be showing at this
 * time. IllegalStateException is thrown if component is already showing.
 * @param initJob Instance of initialization job.
 */
public AsyncInitSupport(Component comp4Init, AsyncGUIJob initJob) {
  this.comp4Init = comp4Init;
  this.initJob = initJob;
  if (comp4Init.isShowing()) {
    throw new IllegalStateException(
      "Component already shown, can't be inited: " + comp4Init
    );
  }
  Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.PAINT_EVENT_MASK);
  comp4Init.addHierarchyListener(this);
  if (!RepaintManager.currentManager(comp4Init).isDoubleBufferingEnabled()) {
    //We're running with hardware double buffering - cannot rely on an
    //AWT PaintEvent to start the job running - on mac, it will never come
    timer = new Timer (20, this);
    timer.start();
  }
}
Timer timer = null;

代码示例来源:origin: stackoverflow.com

boolean wasDoubleBuffered = repaintManager.isDoubleBufferingEnabled();
try {
  repaintManager.setDoubleBufferingEnabled(false);

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

/**
 * Paints the component widget.
 */
@Override
protected final void paintWidget() {
  RepaintManager rm = RepaintManager.currentManager(null);
  boolean isDoubleBuffered = component instanceof JComponent && rm.isDoubleBufferingEnabled();
  if (isDoubleBuffered) {
    rm.setDoubleBufferingEnabled(false);
  }
  Graphics2D graphics = getGraphics();
  Rectangle bounds = getClientArea();
  AffineTransform previousTransform = graphics.getTransform();
  graphics.translate(bounds.x, bounds.y);
  double zoomFactor = getScene().getZoomFactor();
  graphics.scale(1 / zoomFactor, 1 / zoomFactor);
  if (componentVisible) {
    componentWrapper.doPaint(graphics);
  } else {
    component.paint(graphics);
  }
  graphics.setTransform(previousTransform);
  if (isDoubleBuffered) {
    rm.setDoubleBufferingEnabled(true);
  }
}

代码示例来源:origin: stackoverflow.com

if(!printing && repaintManager.isDoubleBufferingEnabled() &&
  !getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered()) {

代码示例来源:origin: com.harium.propan/propan-jogl

/**
 * Paints using the {@code GLGraphics2D} object. This could be forwarded to
 * any code that expects to draw using the Java2D framework.
 * <p>
 * Currently is paints the component provided, turning off double-buffering in
 * the {@code RepaintManager} to force drawing directly to the
 * {@code Graphics2D} object.
 * </p>
 */
@Override
protected void paintGL(GLGraphics2D g2d) {
 RepaintManager mgr = RepaintManager.currentManager(comp);
 boolean doubleBuffer = mgr.isDoubleBufferingEnabled();
 mgr.setDoubleBufferingEnabled(false);
 canvas.g2d = g2d;
 if (isPaintingDirtyRects()) {
  paintDirtyRects();
 } else {
  comp.paint(g2d);
 }
 canvas.g2d = null;
 mgr.setDoubleBufferingEnabled(doubleBuffer);
}

代码示例来源:origin: net.sf.ingenias/editor

RepaintManager currentManager = RepaintManager.currentManager(jw
    .getRootPane());
boolean dBufferOn = currentManager.isDoubleBufferingEnabled();

代码示例来源:origin: net.sf.squirrel-sql.plugins/graph

boolean origDoubleBufferingEnabled = RepaintManager.currentManager(this).isDoubleBufferingEnabled();

代码示例来源:origin: bcdev/beam

protected final void setPreferences() {
  //////////////////////////////////////////////////////////////
  // Store file history
  fileHistory.copyInto(getPreferences());
  //////////////////////////////////////////////////////////////
  // Store frame properties
  getPreferences().setPropertyInt("frame.location.x", getMainFrame().getLocation().x);
  getPreferences().setPropertyInt("frame.location.y", getMainFrame().getLocation().y);
  getPreferences().setPropertyInt("frame.size.width", getMainFrame().getSize().width);
  getPreferences().setPropertyInt("frame.size.height", getMainFrame().getSize().height);
  getPreferences().setPropertyBool("frame.ui.dblbuf",
                   RepaintManager.currentManager(getMainFrame()).isDoubleBufferingEnabled());
  //////////////////////////////////////////////////////////////
  getPreferences().setPropertyBool(PROPERTY_KEY_APP_DEBUG_ENABLED, debugEnabled);
}

相关文章