2.3.9 Nested Views Codehs May 2026

var infoText = new Text("Welcome to nested views!"); infoText.setColor("black"); infoText.setPosition(contentView.getX() + 10, contentView.getY() + 30); add(infoText); Here is the full, runnable solution. Copy and paste this into the CodeHS editor for 2.3.9.

function start() { // All your code goes here } Create a rectangle that acts as the main container. Give it a neutral background, like light gray, and a border so you can see its boundaries. 2.3.9 nested views codehs

var contentView = new Rectangle(260, 300); contentView.setColor("white"); contentView.setBorderWidth(1); contentView.setPosition(parentView.getX() + 20, parentView.getY() + 80); add(contentView); Place a button or a text block inside contentView . var infoText = new Text("Welcome to nested views

Child position = Parent position + Offset. infoText.setPosition(contentView.getX() + 10