package my1;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
public class mydlg2 extends Dialog {
/**
* Create the dialog
* @param parentShell
*/
public mydlg2(Shell parentShell) {
super(parentShell);
}
/**
* Create contents of the dialog
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
//
return container;
}
/**
* Create contents of the button bar
* @param parent
*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}
/**
* Return the initial size of the dialog
*/
@Override
protected Point getInitialSize() {
return new Point(500, 375);
}
}
在下面主菜单中死活不能调用成功???
private JMenuItem getXaMenuItem() {
if (xaMenuItem == null) {
xaMenuItem = new JMenuItem();
xaMenuItem.setText( "eclipse_Jdlg ");
mydlg2 my12=new mydlg2(null); //此句出错!!
my12.open();
}
return xaMenuItem;
}
------解决方案--------------------
错误信息是什么?