combo的使用

    技术2022-05-11  75

            combo  =   new  Combo(shell, SWT.NONE);        combo.setBounds( 38 29 125 20 );         final  Button button  =   new  Button(shell, SWT.NONE);        button.addSelectionListener( new  SelectionAdapter()  {            public void widgetSelected(SelectionEvent e)            {                combo.removeAll();                for (int i=0;i<=9;i++)                {                    combo.add(""+i+"个字符串");                    combo.select(0);                }            }        } );        button.setText( " 设置 " );        button.setBounds( 38 101 48 22 );         final  Button button_1  =   new  Button(shell, SWT.NONE);        button_1.addSelectionListener( new  SelectionAdapter()  {            public void widgetSelected(SelectionEvent e)            {                MessageDialog.openInformation(shell, null, combo.getText());            }        } );        button_1.setText( " 取值 " );        button_1.setBounds( 142 101 48 22 );  

    最新回复(0)