經常使用UI框架經過Graphics徹底自定義組件的方法

flash/flex: 框架

     每個在flash player中的可視化對象都包含flash.display.Graphics類的實例。 ide

       基於flex框架,一般override protected function updateDisplayList(w:Number,h:Number):void;

awt/swing: flex

     經過繼承JComponent類或其子類,有兩種方法獲取Graphics或者Graphics2D類的實例: 對象

       1.從@override void paintComponent(Griphics g),繪製結果是持久的。
       2.經過調用JComponent實例的方法getGraphics方法獲取,繪製結果非持久的。

swt/jface:   繼承

     經過繼承Composite類或其子類自定義組件。 ip

       有兩種使用GC對象的方法:        1.使用GC的構造方法來建立GC對象。          GC(Drawable drawable)或者GC(Drawable drawable,int style)        2.經過addPaintListener(                      new PaintListener(){                           public void paintControl(PaintEvent e){                                e.gc.drawOval(0,0,80,80);                           }                     }                 );
相關文章
相關標籤/搜索