Swt中自定义对话框的总结

本文详细介绍了如何在Eclipse RCP开发中自定义对话框,包括继承Dialog类,设置对话框大小,创建界面,定义按钮,管理按钮状态,处理按钮事件以及获取和设置组件值的方法。
摘要由CSDN通过智能技术生成
在rcp开发中,要自定义对话框,首先要继承org.eclipse.jface.dialogs.Dialog
public class MyDialog extends Dialog
1,定义对话框大小,需要重写getInitialSize方法
[color=gray][b]@Override
protected Point getInitialSize() {
return new Point(540,480);
}[/b][/color]
2,定义对话框界面,需要重写createDialogArea方法.以下是org.eclipse.jface.
dialogs.Dialog的createDialogArea方法的源码,我们可以根据需要在里面添加自己需要的组件
[color=gray][b]protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACIN
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值