totalGraphics.setClip(bounds); setDoubleBuffered(false); paintComponent(totalGraphics);
component.setDoubleBuffered(true);
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);
public static void restoreDoubleBuffering(JComponent c, boolean wasBuffered) { if (c != null) { c.setDoubleBuffered(wasBuffered); } }
public void action(Component c) { map.put(c, Boolean.TRUE); ((JComponent) c).setDoubleBuffered(false); }
public void action(Component c) { map.put(c, Boolean.FALSE); ((JComponent) c).setDoubleBuffered(true); }
public void action(Component c) { Boolean value = map.get(c); if (value != null) { ((JComponent) c).setDoubleBuffered(Boolean.TRUE.equals(value)); } }
public static boolean disableDoubleBuffering(JComponent c) { if (c == null) { return false; } c.setDoubleBuffered(false); return c.isDoubleBuffered(); }
/** * 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); } } }
/** * 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); }
/** * 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); }
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); } } }
/** * 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; }
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); } } }
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; }
/** * 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); }
/** * 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 ); } } } }
/** * 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) }
/** * 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); } }
//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)); }