srecord noeq JG22NetworkElement(JG22Network parent, G22NetworkElement element) is Swingable { cachedVisualize { var box = jMinSize(400, 300, jcenteredlabel("Drag or resize me!")); setOpaqueBackground(Color.white, box); setBorder(box, BorderFactory.createLineBorder(Color.green, 10); onMouseDown(box, event -> { if (!mouseEventIsInBorder(event)) new ComponentDragger(box, event); }); new ComponentResizeDragger(box, box); var bounds = or(element.bounds, rect(50, 50, 400, 300)); setBounds(box, bounds); onBoundsChange(box, r { element.bounds(toRect(getBounds(box))); element.network.change(); parent.mainPanel.revalidateMe(); }); ret box; } }