List of usage examples for java.awt Graphics clearRect
public abstract void clearRect(int x, int y, int width, int height);
From source file:Main.java
public void paint(Graphics g) { g.setColor(Color.RED); g.clearRect(0, 0, 100, 100); }
From source file:TextLayoutWithMouseClickDrag.java
public void update(Graphics g) { g.clearRect(0, 0, getWidth(), getHeight()); paintComponent(g); }
From source file:SlidePuzzle.java
public void paint(Graphics g) { if (m_fAllLoaded) { Rectangle r = g.getClipRect(); g.clearRect(r.x, r.y, r.width, r.height); g.drawImage(logo, 0, 0, null);/*from w w w. j a va2s . com*/ } else g.drawString("Loading images...", 10, 20); }
From source file:SwingTypeTester8.java
protected synchronized void paintComponent(Graphics gc) { Dimension d = getSize();// w ww . j av a 2 s . c o m gc.clearRect(0, 0, d.width, d.height); if (tmpChar[0] == 0) return; int charWidth = fm.charWidth((int) tmpChar[0]); gc.drawChars(tmpChar, 0, 1, (d.width - charWidth) / 2, fontHeight); }
From source file:SwingTypeTester8.java
public synchronized void paintComponent(Graphics gc) { if (tmpChar[0] == 0) return;/*from w w w . j a v a 2 s .com*/ Dimension d = getSize(); int charWidth = fm.charWidth(tmpChar[0]); gc.clearRect(0, 0, d.width, d.height); gc.drawChars(tmpChar, 0, 1, curX++, fontHeight); if (curX > d.width - charWidth) curX = 0; }
From source file:Animator.java
/** * Paint the current frame./* ww w . java2 s .c om*/ */ public void paint(Graphics g) { if (error || !loaded) { if (startUpImage != null) { if (tracker.checkID(STARTUP_ID)) { g.drawImage(startUpImage, 0, 0, this); } } else { if (backgroundImage != null) { if (tracker.checkID(BACKGROUND_ID)) { g.drawImage(backgroundImage, 0, 0, this); } } else { g.clearRect(0, 0, maxWidth, maxHeight); } } } else { if ((images != null) && (images.size() > 0)) { if (frameNum < images.size()) { if (backgroundImage == null) { offScrGC.fillRect(0, 0, maxWidth, maxHeight); } else { offScrGC.drawImage(backgroundImage, 0, 0, this); } Image image = (Image) images.elementAt(frameNum); Point pos = null; if (positions != null) { pos = (Point) positions.get(frameNumKey); } if (pos != null) { xPos = pos.x; yPos = pos.y; } offScrGC.drawImage(image, xPos, yPos, this); g.drawImage(offScrImage, 0, 0, this); } else { // no more animation, but need to draw something dbg("No more animation; drawing last image."); if (backgroundImage == null) { g.fillRect(0, 0, maxWidth, maxHeight); } else { g.drawImage(backgroundImage, 0, 0, this); } g.drawImage((Image) images.lastElement(), 0, 0, this); } } } }
From source file:userinterface.properties.GUIGraphHandler.java
public void paintComponent(Graphics g) { super.paintComponent(g); g.clearRect(0, 0, this.getWidth(), this.getHeight()); }