@Override public void repaint(int x, int y, int width, int height, boolean immediate) { if (immediate) { Graphics2D graphics = (Graphics2D)displayHost.getGraphics(); // If the display host has been made non-displayable (as will // happen when the native peer closes), graphics will be null if (graphics != null) { double scale = displayHost.getScale(); if (scale == 1) { graphics.clipRect(x, y, width, height); } else { graphics.clipRect((int)Math.floor(x * scale), (int)Math.floor(y * scale), (int)Math.ceil(width * scale) + 1, (int)Math.ceil(height * scale) + 1); } displayHost.paint(graphics); graphics.dispose(); } } else { displayHost.repaint(x, y, width, height); } }
@Override public void repaint(int x, int y, int width, int height, boolean immediate) { if (immediate) { Graphics2D graphics = (Graphics2D)displayHost.getGraphics(); // If the display host has been made non-displayable (as will // happen when the native peer closes), graphics will be null if (graphics != null) { double scale = displayHost.getScale(); if (scale == 1) { graphics.clipRect(x, y, width, height); } else { graphics.clipRect((int)Math.floor(x * scale), (int)Math.floor(y * scale), (int)Math.ceil(width * scale) + 1, (int)Math.ceil(height * scale) + 1); } displayHost.paint(graphics); graphics.dispose(); } } else { displayHost.repaint(x, y, width, height); } }
private void repaintDragRepresentation() { DragSource dragSource = dragDescendant.getDragSource(); Visual dragRepresentation = dragSource.getRepresentation(); if (dragRepresentation != null) { Point dragOffset = dragSource.getOffset(); repaint(dragLocation.x - dragOffset.x, dragLocation.y - dragOffset.y, dragRepresentation.getWidth(), dragRepresentation.getHeight()); } }
private void repaintDragRepresentation() { DragSource dragSource = dragDescendant.getDragSource(); Visual dragRepresentation = dragSource.getRepresentation(); if (dragRepresentation != null) { Point dragOffset = dragSource.getOffset(); repaint(dragLocation.x - dragOffset.x, dragLocation.y - dragOffset.y, dragRepresentation.getWidth(), dragRepresentation.getHeight()); } }