Clear « GlassPane « Java Swing Q&A





1. Can't clear glassPane    coderanch.com

public void drawInGlassPane(int x, int y, int width, int height) { Graphics graphics = this.parentGlassPane.getGraphics(); Color transparent = new Color(225, 225, 225, 225); graphics.setColor(transparent); graphics.drawRect(this.previousX, this.previousY, this.previousWidth, this.previousHeight); // Clear the glass pane. ; graphics.setColor(Color.RED); graphics.drawRect(x, y, width, height); this.previousX = x; this.previousY = y; this.previousWidth = width; this.previousHeight = height; }