/Users/andrea/_magisterarbeit/korpus/clean/trainkorpus/32/file5.html NN ----------------------------------------- : Home NP List NP of IN Packages NNS java NP . SENT awt NN 78 CD examples NNS Drawing VVG 7 CD examples NNS e SYM 575 CD . SENT The DT Quintessential JJ Drawing NN Program NN To TO draw VV on IN the DT screen NN , , it PP is VBZ first RB necessary JJ to TO subclass VV a DT JComponent NN and CC override VV its PP$ paint NN method NN . SENT The DT paint NN method NN is VBZ automatically RB called VVN by IN the DT windowing VVG system NN whenever WRB component's NNS area NN needs VVZ to TO be VB repainted VVN . SENT The DT paint NN method NN is VBZ supplied VVN a DT graphics NNS context NN which WDT is VBZ used VVN to TO draw VV shapes NNS and CC images NNS . SENT The DT coordinate VV system NN of IN a DT graphics NNS context NN is VBZ such JJ that IN the DT origin NN is VBZ at IN the DT northwest RB corner JJ and CC x NN axis NN increases NNS toward IN the DT right NN while IN the DT y NP axis NN increases NNS toward IN the DT bottom NN . SENT This DT example NN defines VVZ a DT component NN that WDT draws VVZ an DT oval NN and CC installs VVZ an DT instance NN of IN this DT component NN in IN a DT frame NN . SENT See VVP also RB e SYM 586 CD Drawing NN Simple JJ Shapes NNS . SENT import NN java NP . SENT awt NN . SENT . SENT import NN javax NN . SENT swing NN . SENT . SENT public JJ class NN BasicDraw NP public JJ static JJ void NN main JJ String NP args NNS new JJ BasicDraw NP . SENT BasicDraw NNS Create VVP a DT frame NN JFrame NN frame NN new JJ JFrame NP . SENT Add VV a DT component NN with IN a DT custom NN paint NN method NN frame NN . SENT getContentPane NN . SENT add VV new JJ MyComponent NN . SENT Display VV the DT frame NN int NP frameWidth NP 300 CD . SENT int NP frameHeight NP 300 CD . SENT frame NN . SENT setSize JJ frameWidth NN , , frameHeight NN . SENT frame NN . SENT setVisible JJ true JJ . SENT class NN MyComponent NN extends VVZ JComponent NP This DT method NN is VBZ called VVN whenever WRB the DT contents NNS needs VVZ to TO be VB painted VVN public JJ void NN paint NN Graphics NP g NN Retrieve VVP the DT graphics NNS context NN . SENT this DT object NN is VBZ used VVN to TO paint VV shapes NNS Graphics NP 2 CD D NP g NN 2 CD d SYM Graphics NP 2 CD D NP g NN . SENT Draw VV an DT oval NN that WDT fills VVZ the DT window NN int NP x NN 0 CD . SENT int NP y NP 0 CD . SENT int NP width NN getSize NN . SENT width NN 1 CD . SENT int NP height NN getSize NN . SENT height NN 1 CD . SENT g NN 2 CD d SYM . SENT drawOval NN x SYM , , y NP , , width NN , , height NN . SENT