Unable to get juce::ProgressBar to render in VST

I’m trying to make a simple VST where user drags a file in, a background thread (progressBarThread) reads the file and updates the progress bar.

I just can’t get the progress bar to appear!

What I’m seeing is that the text in paint() function works great, and I see it. The progressBarThread also works great, but the progressBar is never visible.

I’m sure I’m just misunderstanding something simple about how components work?

This is my simple code so far (PluginEditor.cpp):

#include "PluginProcessor.h"
#include "PluginEditor.h"

TutorialVSTTryTwoAudioProcessorEditor::TutorialVSTTryTwoAudioProcessorEditor (TutorialVSTTryTwoAudioProcessor& p)
    : AudioProcessorEditor (&p), audioProcessor (p)
{
    progressBar = std::make_unique<juce::ProgressBar>(progressBarThread.progress);

    progressBar.get()->setPercentageDisplay(true);
    progressBar.get()->setCentrePosition(200, 200);
    this->addAndMakeVisible(progressBar.get());
    
    setSize (600, 400);
}

TutorialVSTTryTwoAudioProcessorEditor::~TutorialVSTTryTwoAudioProcessorEditor() {
    progressBarThread.stopThread(1000);
}

void TutorialVSTTryTwoAudioProcessorEditor::paint (juce::Graphics& g)
{
    g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
    g.setColour (juce::Colours::white);
    g.setFont (12.0f);
    
    if (this->mixtureFilepath.length() > 1) {
        g.drawFittedText ("File loaded: " + this->filepath, getLocalBounds(), juce::Justification::centred, 1);
    } else {
        g.drawFittedText ("Drag and drop your file here...", getLocalBounds(), juce::Justification::centred, 1);
    }
    
    progressBar.get()->repaint();
    this->addAndMakeVisible(progressBar.get());
}

void TutorialVSTTryTwoAudioProcessorEditor::resized() { }

bool TutorialVSTTryTwoAudioProcessorEditor::isInterestedInFileDrag (const juce::StringArray &files) {
    if (files.size() > 1) return false;
    juce::String file = files[0];
    if (file.contains(".wav")) return true;
    return false;
}

void TutorialVSTTryTwoAudioProcessorEditor::filesDropped (const juce::StringArray &files, int x, int y) {
    this->filepath = files[0];
    repaint();
    progressBarThread.startThread();
}

Curious if this is the right approach for adding components and making them visible, even beyond this small fix, too.

Thanks!

Where and at what size do you expect the progress bar to appear? I think you forgot a setBounds call in resized.