1 Replies - 806 Views - Last Post: 04 November 2008 - 04:29 PM Rate Topic: -----

#1 drewp6023  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 02-November 08

Double Buffering?

Post icon  Posted 04 November 2008 - 03:54 PM

I need this file to use double buffering to display a different font(along with its color) when I push this "randomize" button. It doesn't seem right though; it compiles button when I put it in an applet it doesn't display.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MovingTextDisplay extends JPanel {
	private MovingText mt;
	private Image img;
	
	public MovingTextDisplay() {
		mt = null;
	}
	public MovingTextDisplay(MovingText mt) {
		this.mt = mt;
	}
	public void offscreenImage(int width, int height) {
		img = createImage(width, height);
	}
	public void paintComponent(Graphics g) {
		Graphics graph = img.getGraphics();
		graph.setColor(Color.YELLOW);
		g.drawImage(img,0,0,this);
	}
}



Is This A Good Question/Topic? 0
  • +

Replies To: Double Buffering?

#2 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: Double Buffering?

Posted 04 November 2008 - 04:29 PM

how are you putting it in an applet? Perhaps http://www.dreaminco...wtopic28410.htm might help, you don't even extend an applet class.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1