JAVA工程笔记:SWT控件学习之Combo

来源:互联网 发布:好看的剧情电影 知乎 编辑:程序博客网 时间:2024/05/21 13:39

import 包导入

import org.eclipse.swt.widgets.Combo

Style 属性

DROP_DOWN, READ_ONLY, SIMPLE

Event 事件

DefaultSelection, Modify, Selection, Verify, OrientationChange

Constructor 构造

Combo(Composite parent, int style)

Method 方法

  1. 选择事件监听方法
void addSelectionListener(SelectionListener listener)

说明:在Combo控件中选中的项目发生改变时,用此方法处理事件,需配合SelectionAdapterSelectionEvent一起使用
使用方法示例:

combo.addSelectionListener(new SelectionAdapter() {    public void widgetSelected(SelectionEvent e) {        switch (combo.getSelectionIndex()) {        case 0:            System.out.println("选中了第一个项目");            break;        default:            System.out.println("选中了其他项目");            break;        }    }});
0 0
原创粉丝点击