input stringlengths 10 828 | output stringlengths 5 107 |
|---|---|
public void cursor right if cursor pos data length if cursor pos view offset view count view offset cursor pos | move the cursor right |
public int get width sprite cur frame frames get current frame sprite return cur get width | get the width of the current showing frame |
public void mouse pressed mouse event e if down contains e get point if top index elements size view count 2 top index else if up contains e get point if top index 0 top index else if e get point x bounds x 10 int new index top index e get point y bounds y font get character height if new index 0 new index elements size selected index new index | notification that the mouse has been pressed in this |
public void draw for int i 0 i widgets size i widget widget widget widgets get i if widget is hidden widget draw | draw the contents of this container |
public component to component return get active component | returns the component that actually represents this frame |
public void added container container this font container get font super added container | notification that this widget has been added to a |
public void draw if added return if width 1 height font get character height width font get character width label length tx bounds width width 2 bounds x tx bounds x 2 ty bounds y bounds height bounds height height 2 font draw tx ty label color | draw the widget |
public string get raw data return data | get the raw contents of the buffer |
public void request focus widget widget if focused null focused release focus focused widget | request that focus be handed to a particular widget |
public void added container container this drawer container get geom drawer this font container get font super added container | notification that this widget has been added to a specified container |
public int get height sprite cur frame frames get current frame sprite return cur get height | get the height of the current showing frame |
public void draw if added return j2 dacolor temp color if disabled temp temp darker darker if width 1 height font get character height width font get character width label length tx bounds width width 2 bounds x ty bounds y bounds height bounds height height 2 if pressed temp temp darker drawer fill rect bounds x bounds y bounds width bounds height j2 dacolor black false drawer draw rect bounds temp font draw tx ty label temp | draw this component |
public string get data if is focused if cursor pos 1 return data string temp data substring 0 cursor pos data substring cursor pos return temp else return data | get the displayable contents of the field |
public void key pressed key event e if focused null if focused is hidden focused key pressed e | notification that a key has been pressed |
public void mouse entered mouse event e boolean mouse down if disabled return if mouse down pressed was pressed was pressed false else was pressed false | notification that the mouse cursor has entered this component |
public void mouse exited mouse event e boolean mouse down if disabled return was pressed pressed pressed false | notification that the mouse cursor has exited this component |
public void key released key event e if focused null if focused is hidden focused key released e | notification that a key has been released |
public void mouse pressed mouse event e if disabled return pressed true | notification that the mouse has been pressed |
public void del if data length 0 cursor pos 0 data data substring 0 cursor pos 1 data substring cursor pos if cursor pos view offset view offset cursor pos | delete the character next to the current cursor |
public void mouse released mouse event e if disabled return if pressed pressed false container fire action this | notification that the mouse has been released |
public void key typed key event e if focused null if focused is hidden focused key typed e | notification that a key has been typed |
public void start frame start time time util get time | start the timer on this frame |
public void mouse clicked mouse event e point pt new point e get point x e get point y panel get yoffset for int i 0 i widgets size i widget widget widget widgets get i if widget is hidden if widget get bounds contains pt widget mouse clicked e | notification that the mouse has been clicked in this container |
public void draw line int x1 int y1 int x2 int y2 j2 dacolor color graphics2 d g j2 dbuffer game panel get graphics context g set stroke stroke g set color color to awtcolor g draw line x1 y1 x2 y2 | draws a colored line |
public game panel get game panel game frame renderer renderer return new j2 dgame panel renderer | returns a game panel |
public void draw rect rectangle rectangle draw rect rectangle j2 dacolor white | draw a white rectangle |
public boolean is done return time util get time start time duration | check if the frame should be changed e |
public void draw rect rectangle rectangle j2 dacolor color graphics2 d g j2 dbuffer game panel get graphics context g set stroke stroke g set color color to awtcolor g draw rectangle | draws a colored rectangle |
public game frame get game frame game frame renderer renderer string title int width int height int bpp int refresh return new j2 dgame frame renderer title width height bpp refresh | returns a fullscreen game frame |
public sprite get sprite game panel game panel string ref throws ioexception return new j2 dsprite game panel ref | returns a sprite |
public void mouse pressed mouse event e point pt new point e get point x e get point y panel get yoffset for int i 0 i widgets size i widget widget widget widgets get i if widget is hidden if widget get bounds contains pt widget mouse pressed e | notification that the mouse has been pressed in this container |
public void draw rect int x int y int width int height j2 dacolor color graphics2 d g j2 dbuffer game panel get graphics context g set stroke stroke g set color color to awtcolor g draw new rectangle x y width height | draw a colored rectangle |
public sprite sheet get sprite sheet game panel game panel string ref int xcount int ycount throws ioexception return new j2 dsprite sheet game panel ref xcount ycount | returns a sprite sheet |
public void start last time time util get time new thread public void run go start right for xp not sure how to detect decoration offset 29 | starts the game panel |
public object clone animated sprite cloned new animated sprite for int i 0 i frames size i cloned add sprite frame frames get i sprite frame frames get i duration if playing cloned play else cloned pause return cloned | returns a copy of this sprite |
public bitmap font get bitmap font game panel game panel string ref int xcount int ycount throws ioexception return new j2 dbitmap font game panel ref xcount ycount | returns a bitmap font |
public void mouse released mouse event e point pt new point e get point x e get point y panel get yoffset for int i 0 i widgets size i widget widget widget widgets get i if widget is hidden if widget get bounds contains pt widget mouse released e | notification that the mouse has been released in this container |
public geom drawer get geom drawer game panel game panel return new j2 dgeom drawer game panel | returns the geometry drawer for a given game panel |
public void start last time time util get time new thread public void run go start | starts the game panel |
private image get image for char int font char c c 32 int x c 16 int y c 16 font 8 return sheet get image x y | returns the image for a certain character |
public void mouse dragged mouse event e move e true | notification that the mouse has been dragged in this container |
public sprite get sprite game panel game panel image image throws ioexception return new j2 dsprite game panel image | build a sprite from a specified image |
public void stop todo stop the thread | stops the game panel |
public int get width string text return int text length sheet get width 0 55 | returns the width in pixels of the specified text if rendered |
private void cut image sheet int xs sheet get width null width int ys sheet get height null height images new image xs ys for int x 0 x xs x for int y 0 y ys y images x y new buffered image width height buffered image type int argb images x y get graphics draw image sheet x width y height null images x y image loader create masked image images x y | cuts the sheet into images and stores them in the class |
public void draw int x int y string text graphics2 d g j2 dbuffer game panel get graphics context for int i 0 i text length i g draw image get image for char 0 text char at i int x i sheet get width 5 3 y get character height null | draw a message into the game panel at a specified locaiton |
public image get image int x int y return images x y | gets the image on a certain positon on the grid |
public void draw int x int y string text j2 dacolor color graphics2 d g j2 dbuffer game panel get graphics context for int i 0 i text length i g draw image get image for char 0 text char at i int x i sheet get width 5 3 y get character height null | draw a message into the game panel at a specified locaiton |
public graphics2 d get graphics context if current graphics null current graphics graphics2 d strategy get draw graphics current graphics translate xoffset yoffset return current graphics | gets the current graphics2 d context used for this frame |
public void go init while true draw try thread sleep 10 catch exception ex ex print stack trace | starts the drawing in the game panel |
public void draw int xpos int ypos int grid x int grid y graphics2 d g j2 dbuffer game panel get graphics context g draw image images grid x grid y xpos ypos null | draws a single sprite element |
public void mouse moved mouse event e move e false | notification that the mouse has been moved in this container |
public int get character width return sheet get width 4 | returns the width of a single character in this font |
public void draw int xpos int ypos float rotation int grid x int grid y graphics2 d g j2 dbuffer game panel get graphics context affine transform trans affine transform get translate instance xpos ypos if rotation 0 trans concatenate affine transform get rotate instance math to radians rotation g draw image images grid x grid y trans null | draws a single sprite element |
public void swap screen if current graphics null current graphics null strategy show | swaps the screens |
public int get character height return sheet get height | returns the height of a single character in this font |
public void draw graphics g get graphics context if g null return g set color color black g fill rect 0 0 get width get height renderer draw this swap screen frame count if time util get time last time 1000 fps frame count frame count 0 last time time util get time | draws the contents of this panel by calling the renderer |
public void go init while true draw | starts the drawing in the game frame |
public void draw int x int y draw float x float y | draws the sprite at the specified location |
public void move mouse event e boolean mouse down point pt new point e get point x e get point y panel get yoffset for int i 0 i widgets size i widget widget widget widgets get i if widget is hidden if widget get bounds contains pt if widgets in contains widget widget mouse entered e mouse down widgets in add widget else if widgets in contains widget widget mouse exited e mouse down widgets in remove widget | handle the mouse moving around the container |
public void draw int x int y float rotation draw float x float y rotation | draws the sprite at the specified location with the specified rotation |
public graphics2 d get graphics context if strategy null this has to be here because create buffer strategy is only able to work if the canvas is showing try create buffer strategy 4 strategy get buffer strategy catch exception ex if strategy null fallback mode return graphics2 d this get graphics if current graphics null current graphics graphics2 d strategy get draw graphics current graphics translate xoffset yoffset return current graphics | gets the current graphics2 d context used for this panel |
public void draw int x int y float rotation int width int height draw float x float y rotation float width float height | draws the sprite at the specified location at a specified size |
public void set drawing offset int x int y yoffset y xoffset x | set the offset that the contents should be drawn at |
public component get active component return this | returns the active component |
public void draw int x int y float rotation int width int height j2 dacolor col draw float x float y rotation float width float height col | draws the sprite at the specified location at a specified size |
public void draw int x int y graphics2 d g j2 dbuffer game panel get graphics context g draw image image x y null | draws this sprite at a specified location |
public void draw float x float y sprite set overblended over blended sprite draw x float get width 2f y float get height 2f | draws the sprite at the specified location |
public void draw int x int y float rotation graphics2 d g j2 dbuffer game panel get graphics context affine transform trans trans affine transform get translate instance x width 2 y height 2 trans concatenate affine transform get rotate instance math to radians rotation trans concatenate affine transform get translate instance width 2 height 2 g draw image image trans null | draws this sprite at a specified location |
public void draw float x float y float rotation sprite set overblended over blended sprite draw x float get width 2f y float get height 2f rotation | draws the sprite at the specified location with the specified rotation |
public void set icon image image image super set icon image image | sets the icon image of this frame |
public void draw float x float y float rotation float width float height sprite set overblended over blended sprite draw x width 2f y height 2f rotation width height | draws the sprite at the specified location at a specified size |
public void draw int x int y float rotation int w int h graphics2 d g j2 dbuffer game panel get graphics context affine transform trans new affine transform trans concatenate affine transform get translate instance x w 2 y h 2 trans concatenate affine transform get rotate instance math to radians rotation trans concatenate affine transform get translate instance w 2 h 2 trans concatenate affine transform get scale instance double w width double h height g draw image image trans null | draws the sprite at a specified location scaled to a specified size |
public void draw float x float y float rotation float width float height j2 dacolor col sprite set overblended over blended sprite draw x width 2f y height 2f rotation width height col | draws the sprite at the specified location at a specified size |
public void draw int x int y float rotation int w int h j2 dacolor col graphics2 d g j2 dbuffer game panel get graphics context affine transform trans trans affine transform get translate instance x w 2 y h 2 trans concatenate affine transform get rotate instance math to radians rotation trans concatenate affine transform get translate instance w 2 h 2 trans concatenate affine transform get scale instance double w width double h height g draw image image trans null | draws the sprite at a specified location scaled to a specified size |
public void set image provider image provider ip image provider ip image provider add receiver this | sets the image provider which delivers images to this image panel |
public void draw graphics g get graphics context g set color color black g fill rect 0 0 get width get height g translate xoffset yoffset decoration offset renderer draw this swap screen frame count if time util get time last time 1000 fps frame count frame count 0 last time time util get time | draws the contents of this frame by calling the renderer |
public image provider get image provider return image provider | retrieves the image provider which delivers images to this image panel |
public void set name string new name if new name null throw new illegal argument exception parameter is not allowed to be null name new name | set the applications name |
public void draw float x float y float rotation graphics2 d g j2 dbuffer game panel get graphics context affine transform trans trans affine transform get translate instance x width 2 y height 2 trans concatenate affine transform get rotate instance math to radians rotation trans concatenate affine transform get translate instance width 2 height 2 g draw image image trans null | draws this sprite at a specified location |
public int get yoffset return yoffset decoration offset | the vertical offset that the contents are drawn at |
public void set version string new version if new version null throw new illegal argument exception parameter is not allowed to be null version new version | sets the applications version |
public object clone centered sprite cloned new centered sprite sprite return cloned | returns a copy of this sprite |
public void add author string author if author null throw new illegal argument exception parameter is not allowed to be null authors add author | adds an application author |
public collection get authors return collection authors clone | retrieves the names of the authors as a collection |
public string get level ref int i return level levels get i get level ref | get the name of the resource to load for the |
public void draw float x float y float rotation float w float h graphics2 d g j2 dbuffer game panel get graphics context affine transform trans new affine transform trans concatenate affine transform get translate instance x w 2 y h 2 trans concatenate affine transform get rotate instance math to radians rotation trans concatenate affine transform get translate instance w 2 h 2 trans concatenate affine transform get scale instance double w width double h height g draw image image trans null | draws the sprite at a specified location scaled to a specified size |
public int get level time int i return level levels get i get time | get the time limit to apply for a given |
public void set description string new description if new description null throw new illegal argument exception parameter is not allowed to be null description new description | sets the applications description |
public int get level count return levels size | get the number of levels available |
public string get level ref return level ref | get the resource name for this level |
public void draw float x float y float rotation float w float h j2 dacolor col graphics2 d g j2 dbuffer game panel get graphics context affine transform trans trans affine transform get translate instance x w 2 y h 2 trans concatenate affine transform get rotate instance math to radians rotation trans concatenate affine transform get translate instance w 2 h 2 trans concatenate affine transform get scale instance double w width double h height g draw image image trans null | draws the sprite at a specified location scaled to a specified size |
public void set main class name string new main class name if new main class name null throw new illegal argument exception parameter is not allowed to be null main class name new main class name | this method set the applications full qualifies main class name |
private sequence load music string ref try load up the sequence midi track from the reference note we us the class loader that loaded this class to get the reference since we might be running in a controlled environment web start sequence s midi system get sequence midi player class get class loader get resource ref return s catch exception e if we fail to load the music print a message but don t worry too much system out println failed to load music ref return null | load a track from the url references |
public boolean is valid return main class name null name null version null description null authors size 0 | tests whether an application info is valid |
public void run boolean running true running for ever but done with a variable just in case i want to stop it later on while running sleep for a bit so this thread doesn t cycle round too quick try thread sleep 100 catch exception e if the sequence has stopped and we do have a piece of music to play restart it if seq is running current sequence null seq start | implementing the run method of the thread class |
public void set image list list image new image list if new image list null throw new illegal argument exception new image list does not exist image list new image list | sets the list of image instances |
public void add image image image if image null throw new illegal argument exception image to be added does not exist image list add image | adds an image instance to the current list |
private void check player death if map get player get x x map get player get y y map notify player death | check if this badguy has overlapped the player |
public void set overblended boolean over blended this blended over blended | indicates that this sprite should be overblended |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.