I'm trying to implement a vertical tool bar on my paint app with window builder [swing] , but I can't put more than one tool items on it because they keep staying side to side to each other.
And I can't find a place to change the tool item appearance to a icon of my choice.
Here is the part of the code I have tried
ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT);
toolBar.setBounds(0, 0, 43, 319);
formToolkit.adapt(toolBar);
formToolkit.paintBordersFor(toolBar);
ToolItem tltmTool = new ToolItem(toolBar, SWT.NONE);
tltmTool.setText("tool 1");
ToolItem tltmTool_1 = new ToolItem(toolBar, SWT.NONE);
tltmTool_1.setText("tool 2");
if anyone have a tip I would appreciate it
After a little struggle here is the solution i acomplished.
ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT | SWT.VERTICAL);
toolBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
toolBar.setBounds(3, 0, 43, 319);
formToolkit.adapt(toolBar);
formToolkit.paintBordersFor(toolBar);
ToolItem tltmTool = new ToolItem(toolBar, SWT.NONE);
tltmTool.setImage(SWTResourceManager.getImage("C:\\Users\\Magwire\\Pictures\\Icons\\1491427712_mouse-pointer.png"));
tltmTool.setToolTipText("Ferramenta Seta");
ToolItem tltmTool_2 = new ToolItem(toolBar, SWT.NONE);
tltmTool_2.setImage(SWTResourceManager.getImage("C:\\Users\\Magwire\\Pictures\\Icons\\1491429896_draw-08.png"));
tltmTool_2.setToolTipText("Ferramenta Deletar");
it was like @HovercraftFullOfEels and @ostrichofevil said... it is easier to set things the way i want without the GUI, and in the end i used it just to give-me the sample code...
Thanks everyone that helped !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.