Adding toolbar with action to the tab?


I'm trying to create a vertical toolbar on the side of each tab, similar to what the console in IntelliJ has. What happens is the toolbar is created next to the tabs and for some reason it is resized. The icon I use is 32x32, but for some reason it makes it twice as big. My code is:

DefaultActionGroup actionGroup = new DefaultActionGroup();
actionGroup.add(new MyCustomAction());
JComponent toolbar = ActionManager.getInstance().createActionToolbar("MyActionsToolbar", actionGroup, false).getComponent();

What am I doing wrong?

(sorry for asking too many questions lately, I'm struggling with finding good examples and/or tutorials).


1 comment

And, of course, I was able to answer my own question (in a hard way, by reverse engineering a lot of code :))

First I had to set the side component orientation to vertical, e.g.:

outputTabs = new JBTabsPaneImpl(project, SwingConstants.TOP, this);

Second, my icon size was wrong because I was editing a wrong file in Photoshop (stupid me!)

Finally, setting the actions to the tab is as simple as:

tabInfo.setActions(actionGroup, "MyPlace");




Please sign in to leave a comment.