List of usage examples for java.awt Graphics create
public Graphics create(int x, int y, int width, int height)
From source file:krasa.cpu.CpuUsagePanel.java
/** * it will probably be better synchronized, not sure */// w w w .ja v a2s. com private synchronized void draw(Graphics g, Image bufferedImage) { UIUtil.drawImage(g, bufferedImage, 0, 0, null); if (UIUtil.isJreHiDPI((Graphics2D) g) && !UIUtil.isUnderDarcula()) { Graphics2D g2 = (Graphics2D) g.create(0, 0, getWidth(), getHeight()); float s = JBUI.sysScale(g2); g2.scale(1 / s, 1 / s); g2.setColor(UIUtil.isUnderIntelliJLaF() ? Gray.xC9 : Gray.x91); g2.drawLine(0, 0, (int) (s * getWidth()), 0); g2.scale(1, 1); g2.dispose(); } }