Your question about lifetime of this object i cannot understand
Yeah, I think this might be the problem.
When you say something like this,
DrawableButton* UserSelect = new DrawableButton(...);
You are implying that you are going to handle calling delete by yourself in your destructor. Don't let jules see this. He'll blow a gasket.
Hopefully, you have something like this in your class declaration:
class LoginClass : public Component
You should use UserSelect like this in your constructor:
addAndMakeVisible(UserSelect = new DrawableButton ("UserButton", DrawableButton::ImageAboveTextLabel));
UserSelect->setImages(&up, &up, &up);
UserSelect->setBounds(32, 90, 111, 104);
What you have done is redefine a local variable with the type DrawableButton* in your constructor. This is a local override, meaning, it is a different variable than the variable with the same name that has the type ScopedPointer<DrawableButton>. As you have it, you aren't changing the variable ScopedPointer<DrawableButton> UserSelect, which by default contains a null pointer to a DrawableButton. So when you go to use it, the operator->() will return a null pointer. It's important to distinguish that UserSelect itself won't actually be null if you've declared it to be a ScopedPointer in your class declaration. Note, however, that the operator==() and operator!=() have been overloaded so that you can check to see if the pointer managed by ScopedPointer is nullptr.
ScopedPointer<> helps you manage the "birth" and "death" or lifetime of the object in a safe way.