万千封印
您可以通过使其渐变来做到这一点。 buttonGraphics.setPaint(new GradientPaint( new Point(0, 0), Color.RED, new Point(0, getWidth()), Color.BLUE())); buttonGraphics.fillRect(0, 0, getWidth(), getHeight()); buttonGraphics.dispose()