例如 在Group group对象上 动态生成过几个Text text组件现在想在group上移除这个text组件 请问 有对应的方法吗 就像 group.XXX();这样的 API 我看了一下 也有找到合适的高手请指教
解决方案 »
- 寻求一个关于hibernate有关的抓狂的问题
- java实现,从一个图片的url获得图片的缩略图
- java 线程超时问题。。。。。。。。。。。。。。。。。。。。。。。。。。。。
- paint画图问题
- 关于byte数组赋值的问题
- java的一个小问题
- Integer.toHexString(hashCode())是什么意思呀?能吧能举个例子说下?
- ###(项目名称缩写含义)(散100分大家交流下)
- 没学过JAVA所以就问个,比烂白菜还烂的问题 c = (char)((int)a ^ (int)b) 是什么意思?
- 求救!关于编写计算器的计算部分。
- [新人请教!!]关于将汉字转成UNICODE代码的简单程序。。
- JFileChooser 问题求解
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;import cc.component.CCShell;public class Test4Group {
public static void main(String[] args) {
Display display = new Display();
final CCShell shell = new CCShell(display, SWT.CLOSE);
shell.setBounds(200, 200, 300, 380);
final Group gp = new Group(shell, SWT.SHADOW_ETCHED_IN);
gp.setBounds(10, 10, 280, 260);
gp.setText("group");
Button btn = new Button(gp, SWT.NONE);
btn.setText("button1");
btn.setBounds(10, 10, 80, 20);
btn = new Button(gp, SWT.NONE);
btn.setText("button2");
btn.setBounds(10, 40, 80, 20);
btn.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
Control[] ctrl = gp.getChildren();
for (int i = 0;i<ctrl.length;i++) {
if (ctrl[i] instanceof Button && ((Button)ctrl[i]).getText().equals("button1")) {
ctrl[i].dispose();
break;
}
}
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
} display.dispose();
}}