|
|
|
|
SWT制作下拉式toolbar菜单按钮的代码片段 |
|
|
|
作者:未知 来源:月光软件站 加入时间:2005-5-13 月光软件站 |
|
SWT制作下拉式toolbar菜单按钮的代码片段: final ToolItem dropdown = new ToolItem(bar, SWT.DROP_DOWN); dropdown.setText("Drop-down");
//一个popoupMenu final Menu menu = new Menu(shell, SWT.POP_UP); MenuItem choice = new MenuItem(menu, SWT.PUSH); choice.setText("Choices");
dropdown.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (event.detail == SWT.ARROW) { Rectangle rect = dropdown.getBounds(); Point pt = new Point(rect.x, rect.y + rect.height); pt = bar.toDisplay(pt); menu.setLocation(pt.x, pt.y); menu.setVisible(true); } } });
|
|
相关文章:相关软件: |
|