How to add a JComboBox to MainToolBar

Hi,

I would like to know how to add a JComboBox to MainToolBar?

Thanks in advance.

Regards
Boon Ping.

2 comments

Hello Lan,

I would like to know how to add a JComboBox to MainToolBar?


You need to create an action class extending ComboBoxAction, and add it to
the toolbar action group in the usual way.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hi,

I just found the answer.

Extends AnAction and implements CustomerComponentAction.

E.g

public class MyComboBox extends AnAction implements CustomComponentAction
{
public void actionPerformed( AnActionEvent e )
{

}

public JComponent createCustomComponent( Presentation presentation )
{
JComboBox jComboBox = new JComboBox( new String[]{ "haha", "hehe" } );

return jComboBox;
}
}

Anyway thanks.

Regards
Boon Ping.

0

Please sign in to leave a comment.