With the JUCE UI system how do you set the background as an image instead of a solid colour?

gui

#1

Hi there,

I know that you can set a button up and then make it not clickable but that is obviously not the correct way to do it so if anyone has the correct method that would be great!

Thanks for your time!


#2

I think you’re looking for Juce::ImageComponent

Having said that, what you should probably be doing is drawing your background using vectors & gradients.


#3

FYI:

Image bgImg = ImageFileFormat::loadFrom (BinaryData::bg_png, BinaryData::bg_pngSize);

void MainContentComponent::paint(Graphics& g)
{
    g.setTiledImageFill (bgImg, 0, 0, 1.0f);
    g.fillAll();
}