NonFlickerPanel.java
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:1k
源码类别:

OA系统

开发平台:

Java

  1. // Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2002-12-03 18:43:38
  2. // Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
  3. // Decompiler options: packimports(3) 
  4. // Source File Name:   NonFlickerPanel.java
  5. package cn.com.fcsoft.chart;
  6. import java.awt.*;
  7. public class NonFlickerPanel extends Panel
  8. {
  9.     public void invalidate()
  10.     {
  11.         super.invalidate();
  12.         offscreen = null;
  13.     }
  14.     public NonFlickerPanel()
  15.     {
  16.     }
  17.     public NonFlickerPanel(LayoutManager layoutmanager)
  18.     {
  19.         super(layoutmanager);
  20.     }
  21.     public void paint(Graphics g)
  22.     {
  23.         Dimension dimension = getSize();
  24.         if(offscreen == null)
  25.         {
  26.             dimension.width = Math.max(1, dimension.width);
  27.             dimension.height = Math.max(1, dimension.height);
  28.             offscreen = createImage(dimension.width, dimension.height);
  29.         }
  30.         try
  31.         {
  32.             Graphics g1 = offscreen.getGraphics();
  33.             g1.setClip(0, 0, dimension.width, dimension.height);
  34.             super.paint(g1);
  35.             g.drawImage(offscreen, 0, 0, null);
  36.             g1.dispose();
  37.         }
  38.         catch(NullPointerException _ex) { }
  39.     }
  40.     public void update(Graphics g)
  41.     {
  42.         paint(g);
  43.     }
  44.     private Image offscreen;
  45. }