About develop spark plugin

I download the exmaples.jar, I want to add my own tab onto the spark. Here is the codes:

Workspace workspace = SparkManager.getWorkspace();

// Retrieve the Tabbed Pane from the WorkspaceUI.
SparkTabbedPane tabbedPane = workspace.getWorkspacePane();
// Add own Tab.
tabbedPane.addTab(“My plugin”,null, new JButton(“hello”));

However, my own tab(my plugin) shows abnormal, Can anyone help me?

i think it should work this way.

do you get an error like “UI Creation must be done in dispatch thread” or something like that?

maybe you could try this:

EventQueue.invokeLater(new Runnable() {

@Override

public void run() {

tabbedPane.addTab(“My plugin”,null, new JButton(“hello”));

}

});