3. DoubleBufferPanel.

Listing 3. DoubleBufferPanel.


class MyApp extends Frame {  ...
    // decide if we want to use double buffering explicitly or rely on pjava
    EContainer p = null;
    Class comp = Component.class;
    try {
          Method dblchk = comp.getMethod (
	   "isDoubleBuffered", new Class [0]);
          // method exists
          Boolean chk = (Boolean) dblchk.invoke (this, null);
          if (chk.booleanValue()) {
              // no need for double buffering ourselves
	      p = new EContainer ();
    	 }
    }

     catch (NoSuchMethodException x) {
    }
    if (p == null) {
        // check if we made one, else force double buffering
        p = new DoubleBufferPanel ();
    }
...
}

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.