主要代码: BufferedImage image = new BufferedImage(400, 120, BufferedImage.TYPE_4BYTE_ABGR); Graphics2D g2d = image.createGraphics(); g2d.setColor(Color.BLUE); g2d.fillRoundRect(0, 0, 400, 120, 40, 40); g2d.dispose(); g2d = (Graphics2D) g; Image imgScale = image.getScaledInstance(100