抄了段代码,在Eclipse下运行出现如下问题,请问怎么解决
Exceptioninthread"main"java.lang.ClassCastException:java.lang.Integercannotbecasttoor...
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to org.eclipse.swt.layout.GridData
at org.eclipse.swt.layout.GridLayout.layout(Unknown Source)
at org.eclipse.swt.layout.GridLayout.layout(Unknown Source)
at org.eclipse.swt.widgets.Composite.updateLayout(Unknown Source)
at org.eclipse.swt.widgets.Composite.WM_SIZE(Unknown Source)
at org.eclipse.swt.widgets.Canvas.WM_SIZE(Unknown Source)
at org.eclipse.swt.widgets.Decorations.WM_SIZE(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.ShowWindow(Native Method)
at org.eclipse.swt.widgets.Decorations.setVisible(Unknown Source)
at org.eclipse.swt.widgets.Shell.setVisible(Unknown Source)
at org.eclipse.swt.widgets.Shell.open(Unknown Source)
at Calculator.<init>(Calculator.java:43)
at Calculator.main(Calculator.java:151) 展开
at org.eclipse.swt.layout.GridLayout.layout(Unknown Source)
at org.eclipse.swt.layout.GridLayout.layout(Unknown Source)
at org.eclipse.swt.widgets.Composite.updateLayout(Unknown Source)
at org.eclipse.swt.widgets.Composite.WM_SIZE(Unknown Source)
at org.eclipse.swt.widgets.Canvas.WM_SIZE(Unknown Source)
at org.eclipse.swt.widgets.Decorations.WM_SIZE(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Decorations.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.ShowWindow(Native Method)
at org.eclipse.swt.widgets.Decorations.setVisible(Unknown Source)
at org.eclipse.swt.widgets.Shell.setVisible(Unknown Source)
at org.eclipse.swt.widgets.Shell.open(Unknown Source)
at Calculator.<init>(Calculator.java:43)
at Calculator.main(Calculator.java:151) 展开
展开全部
强转出错...,如果确认代码是没问题的,看看你的jdk是不是1.5以上
追问
我用的是JDK1.6,
private Composite com1;
com1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 只有这一段用到了这个,该怎么改?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
类型转换的问题吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询