Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Vertical ToolBar on Application Window


I am trying to add a vertical toolbar to an application window. This seems simple enough but I am getting a horizontal toolbar with the items arranged vertically. Any suggestions?

Also another item. If I comment the addToolBar line and uncomment the addCoolBar line, I don't get a coolbar at all.

Help, please.

Thanks,
Jonquil

public class MyWindow extends ApplicationWindow {

   public MyWindow() {
       super(null);
       addMenuBar();
       addToolBar(SWT.VERTICAL);
       //addCoolBar(SWT.VERTICAL);
   }

   public static void main(String[] args) {
       MyWindow app = new MyWindow();
       app.setBlockOnOpen(true);
       app.open();
       Display.getCurrent().dispose();
   }

   protected MenuManager createMenuManager() {

       MenuManager topManager = new MenuManager();
MenuManager manager = new MenuManager("Fake");
       Action action = makeFakeAction();
       action.setText ("Fake");
manager.add(action); topManager.add(manager);
       return topManager;
   }

   protected ToolBarManager createToolBarManager(int style) {

       ToolBarManager manager = new ToolBarManager(style);
Action action1 = makeFakeAction();
       action1.setText ("Fake 1");
       manager.add(action1);
Action action2 = makeFakeAction();
       action2.setText ("Fake 2");
       manager.add(action2);
return manager;
   }

   protected CoolBarManager createCoolBarManager(int style) {

       CoolBarManager manager = new CoolBarManager(style);
Action action = makeFakeAction();
       action.setText ("Fake");
manager.add(action);
       return manager;
   }

   private Action makeFakeAction() {
       return new Action() {
           public void run() {
               System.out.println("my action");
           }
       };
   }

   protected Control createContents(Composite composite) {
Button button = new Button (composite, SWT.PUSH);
       button.setText("here");
return button;
   }
}
--

.........................
MIT Lincoln Laboratory
Group 33
(781) 981 5245
swann@xxxxxxxxxx



Back to the top