Question

I got three rather small questions so I'd like to ask them all in one thread here.

1- What does Toolkit.getDefaultToolkit().sync() mean?

2- What does g.dispose() do? (g is a Graphics object).

3- What does this: setDoubleBuffered(true) mean?

All of the above happen in a class extending JPanel.

Thanks

Was it helpful?

Solution

  • sync() - sunchronizes the graphics state

  • dispose() - Disposes of this graphics context and releases any system resources that it is using. A Graphics object cannot be used after disposehas been called.

  • setDoubleBuffered() - Sets whether this component should use a buffer to paint. If set to true, all the drawing from this component will be done in an offscreen painting buffer. The offscreen painting buffer will the be copied onto the screen. If a Component is buffered and one of its ancestor is also buffered, the ancestor buffer will be used.


Follow the links. You really need to learn how to search and read documentation.

Here's a link to the Documentation homepage. Anytime you need to ask a question like this, go to this page first, and search.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top