Package com.iizix.swt

Class AWTEmbeddedCompositeResizer

  • All Implemented Interfaces:
    java.util.EventListener, org.eclipse.swt.events.ControlListener, org.eclipse.swt.internal.SWTEventListener

    public class AWTEmbeddedCompositeResizer
    extends java.lang.Object
    implements org.eclipse.swt.events.ControlListener
    Class used to quickly handle resize changes in the SWT-AWT-embed-composite.

    Though it is necessary, setting sun.awt.noerasebackground has negative consequences. Leaving the background uncleared may result in the temporary display of previously drawn pixels (an example of what is sometimes called cheese) during resize operations and before the initial Swing contents are displayed.

    Author:
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static void_add​(org.eclipse.swt.widgets.Composite c)
      Adds a composite that embeds the AWT frame to the resizer.
      voidcontrolMoved​(org.eclipse.swt.events.ControlEvent e) 
      voidcontrolResized​(org.eclipse.swt.events.ControlEvent e)
      Change in composite size.
      static voidinitialize()
      Initializes the AWT for SWT embedding.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initialize

        public static void initialize()
        Initializes the AWT for SWT embedding.
      • _add

        public static void _add​(org.eclipse.swt.widgets.Composite c)
        Adds a composite that embeds the AWT frame to the resizer.
      • controlResized

        public void controlResized​(org.eclipse.swt.events.ControlEvent e)
        Change in composite size.

        These effects are removed by adding a resize listener to the parent SWT composite. When the composite is resized larger, exposing an unpainted region, the listener fills it immediately with the background color. The invalidated region is removed immediately, providing a cosmetic improvement during any delay while the embedded Swing component repaints.

        Specified by:
        controlResized in interface org.eclipse.swt.events.ControlListener
      • controlMoved

        public void controlMoved​(org.eclipse.swt.events.ControlEvent e)
        Specified by:
        controlMoved in interface org.eclipse.swt.events.ControlListener