What are the fundamental differences between using an AWT frame and a Swing JFrame when implementing native rendering, rather than using standard Java GUI components?
This is the previous question:
AWT Custom Rendering - Captures smooth resizing and eliminates flicker
Typical conversation points in Swing vs AWT do not seem to apply, because we only use frames. For example, heavy versus light weight will exit the window (and the JFrame expands the frame).
So what is the best, JFrame or Frame for this situation ? Does that make sense?
Note: this scenario is where rendering in the EDT is not desirable . There is an application workflow that is not EDT related, and rendering is performed as needed outside of the EDT. Rendering synchronization with EDT will add latency to rendering. We do not show any Swing or AWT components other than Frame or JFrame (or the included JPanel / Component / etc, if that is better).
import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import java.awt.Toolkit; import java.awt.image.BufferStrategy; import java.awt.Frame; public class SmoothResize extends Frame { public static void main(String[] args) { Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); SmoothResize srtest = new SmoothResize();
source share