views:

207

answers:

1

Is there a way to have a SWT buuton with both image and text in a view? I have tried embedding Swings in SWT and the view looks exactly as I want, but when there is an operation going on, this view doesnot load till it gets over. This makes my perspective look unstable. Please help.

+1  A: 

What OS are you using? On Windows XP/Vista/Windows 7, GTK+ and OSX you can just set the text and the image. E.g.

public class ButtonView extends ViewPart
{
    private Button  m_button;

    public void createPartControl(Composite parent)
    {
        m_button = new Button(parent, SWT.NONE);
        m_button.setText("My Button"); 
        m_button.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
    }

    public void setFocus()
    {
        m_button.setFocus();
    }
}
Kire Haglin