I'm having some trouble adding the file download wrapper to a button, I've

I’m having some trouble adding the file download wrapper to a button, I’ve almost exactly copied the code from the example and it still isn’t working for me. Would browser choice or user settings not allow a download to happen?

Here’s my code:

FileDownloadWrapper buttonWrapper = new FileDownloadWrapper(new StreamResource("invoice.pdf", () -> new
            ByteArrayInputStream("foo".getBytes())));
    Button downloadButton = new Button("Download");
    buttonWrapper.wrapComponent(downloadButton);

    add(downloadButton);

instead of add(downloadButton) you should use add(buttonWrapper)

It works!

Many thanks for the speedy reply