开发者

Text and Image on SWT Button

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 oper开发者_Go百科ation going on, this view doesnot load till it gets over. This makes my perspective look unstable. Please help.


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();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜