WebLatte¶
-
public class
WebLatte
¶ Created by charlie on 7/19/16.
Methods¶
addButton¶
addInput¶
drawCircle¶
-
public Element
drawCircle
(double cx, double cy, double r, ColorLatte color)¶ Draw a circle into the window will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - cx – the x coordinate of the center of the circle
- cy – the y coordinate of the center of the circle
- r – the radius of the circle
- color – the color of the circle
Returns: the circle element, which you can modify before you paint.
drawEllipse¶
-
public Element
drawEllipse
(double cx, double cy, double rx, double ry, double rot, ColorLatte color)¶ Draw an ellipse into the window will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - cx – the x coordinate of the center of the ellipse
- cy – the y coordinate of the center of the ellipse
- rx – the radius in the x direction
- ry – the radius in the y direction
- rot – the rotation about the center
- color – the color of the ellipse
Returns: the ellipse element, which you can modify before you paint.
drawImage¶
-
public Element
drawImage
(String file, double x, double y, double w, double h, double rot)¶ Draw an image from a local file will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - file – the name of the noun
- x – the x coordinate of the upper left corner
- y – the y coordinate of the upper left corner
- w – the width of the image
- h – the height of the image
- rot – the rotation of the image about the center
Returns: the image element, which you can modify before you paint.
drawLine¶
-
public Element
drawLine
(double x1, double y1, double x2, double y2, double thick, ColorLatte color)¶ Draw a line into the window will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - x1 – the x coordinate of the starting point
- y1 – the y coordinate of the starting point
- x2 – the x coordinate of the ending point
- y2 – the y coordinate of the ending point
- thick – the thickness of the line
- color – the color of the line
Returns: the line element, which you can modify before you paint.
drawNoun¶
-
public Element
drawNoun
(String name, double x, double y, double w, double h, double rot)¶ Draw an image from the noun project will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - name – the name of the noun
- x – the x coordinate of the upper left corner
- y – the y coordinate of the upper left corner
- w – the width of the image
- h – the height of the image
- rot – the rotation of the image about the center
Returns: the image element, which you can modify before you paint.
drawRectangle¶
-
public Element
drawRectangle
(double x, double y, double w, double h, double rot, ColorLatte color)¶ Draw a rectangle into the window. will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - x – the x coordinate of the upper left corner
- y – the y coordinate of the upper left corner
- w – the width of the rectangle
- h – the height of the rectangle
- rot – rotate the rectangle from its center
- color – the color of the rectangle
Returns: the rectangle element, which you can modify before you paint.
drawSVGElement¶
-
public Element
drawSVGElement
(String svg)¶ draw any svg element, see the svg documentation for html5 (advanced function) will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - svg – a string containing valid svg xml
Returns: the svg element, which you can modify before you paint.
drawSVGElement¶
-
public Element
drawSVGElement
(Element node)¶ draw any svg element, see the svg documentation for html5 (advanced function) will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - node – a node containing valid svg representation
Returns: the svg element, which you can modify before you paint.
drawText¶
-
public Element
drawText
(String s, double x, double y, int size, double rot, ColorLatte color)¶ Draw some text into the window will not be visible until you run the paint() function can be cleared with the clearPaint() function
Parameters: - s – the string to draw
- x – the x coordinate of the lower left corner
- y – the y coordinate of the lower left corner
- size – the height of the text
- rot – the rotation of the text
- color – the color of the text
Returns: the text element, which you can modify before you paint.
getWidth¶
-
public int
getWidth
()¶
outertype: | WebLatte the width of the current window
|
---|
getHeight¶
-
public int
getHeight
()¶
outertype: | WebLatte the height of the current window
|
---|
getLeapX¶
-
public int
getLeapX
()¶ the x coordinate of a pointer on the leap controller
Returns: the coordinate in pixels from the upper left corner
getLeapY¶
-
public int
getLeapY
()¶ the y coordinate of a pointer on the leap controller
Returns: the coordinate in pixels from the upper left corner
getValue¶
login¶
nextClick¶
-
public String
nextClick
()¶ Waits for a button to be clicked
Returns: the name of the button that was clicked you can make any element clickable by adding the “clickable” id and giving it a name ex: Element r = drawRectangle(...) r.setAttribute(“class”, “clickable”); r.setAttribute(“name”, “myrectangle”);
nextClick¶
nextLine¶
paint¶
-
public void
paint
()¶ paint the drawing to the screen. the program waits a default 25 milliseconds.
paint¶
-
public void
paint
(long timeout)¶ paint the drawing to the screen.
Parameters: - timeout – the program waits for this number of milliseconds.