Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-20 UTC.
[null,null,["Last updated 2025-05-20 UTC."],[],[],null,["# Rectangle\n\nWatch Face Format version Version 4 Version 3 Version 2 Version 1\n\n*** ** * ** ***\n\nDraws a Rectangle shape.\n\nSyntax\n------\n\n```xml\n\u003cRectangle x=\"float\" y=\"float\" width=\"float\" height=\"float\" /\u003e\n```\n\nAttributes\n----------\n\nThe `Rectangle` element must contain the following attributes:\n\n`x`, `y`, `width`, `height`\n\n: A collection of [geometric attributes](/training/wearables/wff/group/part/draw/style/stroke) that specify the rectangle's size\n and position.\n\n These attributes are [transformable](/training/wearables/wff/common/transform/transform).\n\nInner elements\n--------------\n\nThe `Rectangle` element must contain either a single [`Stroke`](/training/wearables/wff/group/part/draw/style/stroke) element or a\nsingle [`Fill`](/training/wearables/wff/group/part/draw/style/fill) element.\n\nA rectangle can also optionally contain any number of the following elements:\n\n- [`Transform`](/training/wearables/wff/common/transform/transform)\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Rectangle](/training/wearables/wff/v2/group/part/draw/shape/rectangle)\n- [Ellipse](/training/wearables/wff/group/part/draw/shape/ellipse)\n- [RoundRectangle](/training/wearables/wff/group/part/draw/shape/round-rectangle)"]]