// paint: graphics/component width/component height static JComponent dynamicallyPaintedComponent(VF1 paint) { ret swing(func -> JComponent { new JComponent { public void paint(Graphics g) { callF(paint, (Graphics2D) g, getWidth(), getHeight()); } }}); }