javax.swing.JComponent.setDoubleBuffered()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(196)

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

JComponent.setDoubleBuffered介绍

暂无

代码示例

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

totalGraphics.setClip(bounds);
setDoubleBuffered(false);
paintComponent(totalGraphics);

代码示例来源:origin: mabe02/lanterna

component.setDoubleBuffered(true);

代码示例来源:origin: ron190/jsql-injection

JComponent c = (JComponent) layeredPane;
  boolean doubleBuffered = c.isDoubleBuffered();
  c.setDoubleBuffered(false);
  ShadowPopup.paintAll(c, g);
  c.setDoubleBuffered(doubleBuffered);
} else {
  layeredPane.paintAll(g);
  JComponent c = (JComponent) layeredPane;
  boolean doubleBuffered = c.isDoubleBuffered();
  c.setDoubleBuffered(false);
  c.paintAll(g);
  c.setDoubleBuffered(doubleBuffered);
} else {
  layeredPane.paintAll(g);

代码示例来源:origin: nroduit/Weasis

public static void restoreDoubleBuffering(JComponent c, boolean wasBuffered) {
  if (c != null) {
    c.setDoubleBuffered(wasBuffered);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

public void action(Component c) {
  map.put(c, Boolean.TRUE);
  ((JComponent) c).setDoubleBuffered(false);
}

代码示例来源:origin: com.jidesoft/jide-oss

public void action(Component c) {
  map.put(c, Boolean.FALSE);
  ((JComponent) c).setDoubleBuffered(true);
}

代码示例来源:origin: com.jidesoft/jide-oss

public void action(Component c) {
  Boolean value = map.get(c);
  if (value != null) {
    ((JComponent) c).setDoubleBuffered(Boolean.TRUE.equals(value));
  }
}

代码示例来源:origin: nroduit/Weasis

public static boolean disableDoubleBuffering(JComponent c) {
  if (c == null) {
    return false;
  }
  c.setDoubleBuffered(false);
  return c.isDoubleBuffered();
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

/**
 * Set/unset double-buffering for a tree of components. Except JPopupMenu and Window.
 */
public static void setDoubleBuffered(Container _parent, boolean _b) {
 if (_parent != null) {
  // FuLog.debug("NO-DOUBLE-BUFFER: "+_parent.getName());
  Enumeration e = getAllSubComponents(_parent).elements();
  while (e.hasMoreElements()) {
   Component c = (Component) e.nextElement();
   if (c instanceof JPopupMenu) continue;
   if (c instanceof Window) continue;
   if (c instanceof JComponent) ((JComponent) c).setDoubleBuffered(_b);
  }
 }
}

代码示例来源:origin: brandonborkholder/glg2d

/**
 * 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>
 */
protected void paintGL(GLGraphics2D g2d) {
 boolean wasDoubleBuffered = comp.isDoubleBuffered();
 comp.setDoubleBuffered(false);
 comp.paint(g2d);
 comp.setDoubleBuffered(wasDoubleBuffered);
}

代码示例来源: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>
 */
protected void paintGL(GLGraphics2D g2d) {
  boolean wasDoubleBuffered = comp.isDoubleBuffered();
  comp.setDoubleBuffered(false);
  comp.paint(g2d);
  comp.setDoubleBuffered(wasDoubleBuffered);
}

代码示例来源:origin: net.java.dev.jna/jna-platform

protected void setDoubleBuffered(Component root, boolean buffered) {
  if (root instanceof JComponent) {
    ((JComponent)root).setDoubleBuffered(buffered);
  }
  if (root instanceof JRootPane && buffered) {
    ((JRootPane)root).setDoubleBuffered(true);
  }
  else if (root instanceof Container) {
    Component[] kids = ((Container)root).getComponents();
    for (int i=0;i < kids.length;i++) {
      setDoubleBuffered(kids[i], buffered);
    }
  }
}

代码示例来源:origin: girtel/Net2Plan

/**
 * Takes an snapshot of the current state of a component.
 * 
 * @param component Source component
 * @return {@code BufferedImage}
 */
public static BufferedImage takeSnapshot(JComponent component)
{
  Dimension currentSize = component.getSize();
  BufferedImage bi = new BufferedImage(currentSize.width, currentSize.height, BufferedImage.TYPE_INT_ARGB);
  Graphics2D graphic = bi.createGraphics();
  graphic.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  graphic.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  graphic.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
  boolean db = component.isDoubleBuffered();
  component.setDoubleBuffered(false);
  component.paint(graphic);
  graphic.dispose();
  component.setDoubleBuffered(db);
  
  return bi;
}

代码示例来源:origin: net.java.dev.jna/platform

protected void setDoubleBuffered(Component root, boolean buffered) {
  if (root instanceof JComponent) {
    ((JComponent)root).setDoubleBuffered(buffered);
  }
  if (root instanceof JRootPane && buffered) {
    ((JRootPane)root).setDoubleBuffered(true);
  }
  else if (root instanceof Container) {
    Component[] kids = ((Container)root).getComponents();
    for (int i=0;i < kids.length;i++) {
      setDoubleBuffered(kids[i], buffered);
    }
  }
}

代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-jxmap

public static BufferedImage createImage(JComponent component, int imageType) {
  Dimension componentSize = component.getPreferredSize();
  component.setDoubleBuffered(false);
  component.setSize(componentSize);
  component.validate();
  BufferedImage img = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(component.getSize().width,
      component.getSize().height, imageType);
  Graphics2D grap = img.createGraphics();
  component.print(grap);
  grap.dispose();
  return img;
}

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

/**
 * Constructs a new vertex renderer.
 */
public MultiLineVertexRenderer() {
  textPane.setOpaque(false);
  textPane.setBorder(BorderFactory.createEmptyBorder(INSET, INSET, INSET,
      INSET));
  // Makes sure the heavyweights is never returned directly,
  // so that the real component is never touched directly.
  wrapperRenderer = new JComponent() {
    public void paint(Graphics g) {
      if (showHeavyweight) {
        valueComponent.setSize(getSize());
        if (!isEditing)
          valueComponent.paint(g);
      } else {
        g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
        g.drawLine(0, 0, getWidth() - 1, getHeight() - 1);
        g.drawLine(getWidth() - 1, 0, 0, getHeight() - 1);
      }
    }
  };
  wrapperRenderer.setDoubleBuffered(false);
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
  * Prepares the component for drawing. This recursively disables the double-buffering as this would interfere with the
  * drawing.
  *
  * @param c
  *          the component that should be prepared.
  */
 private void prepareComponent( final Component c ) {
  if ( c instanceof JComponent ) {
   final JComponent jc = (JComponent) c;
   jc.setDoubleBuffered( false );
   final Component[] childs = jc.getComponents();
   for ( int i = 0; i < childs.length; i++ ) {
    final Component child = childs[i];
    prepareComponent( child );
   }
  }
 }
}

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

/**
 * Description of the Method
 *
 * @param event  Description of Parameter
 */
public void ancestorAdded(AncestorEvent event) {
 Component parent = event.getComponent().getParent();
 if (parent instanceof JComponent) {
  ((JComponent) parent).setDoubleBuffered(false);
  ((JComponent) parent).setOpaque(false);
 }
 // end of if (parent instanceof JComponent)
}

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

/**
 * Paints the component widget.
 */
protected final void paintWidget () {
  if (getScene ().isPaintEverything ()  ||  ! componentVisible) {
    boolean isDoubleBuffered = component instanceof JComponent  &&  component.isDoubleBuffered ();
    if (isDoubleBuffered)
      ((JComponent) component).setDoubleBuffered (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);
    component.paint (graphics);
    graphics.setTransform (previousTransform);
    if (isDoubleBuffered)
      ((JComponent) component).setDoubleBuffered (isDoubleBuffered);
  }
}

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

//original source: Sun, java/awt/Window.java, setLayersOpaque(Component, boolean)
private static void setLayersTransparent(JFrame frame) {
  JRootPane root = frame.getRootPane();
  root.setOpaque(false);
  root.setDoubleBuffered(false);

  Container c = root.getContentPane();
  if (c instanceof JComponent) {
    JComponent content = (JComponent) c;
    content.setOpaque(false);
    content.setDoubleBuffered(false);
  }
  frame.setBackground(new Color(0, 0, 0, 0));
}

相关文章

JComponent类方法