我有以下代码:
JPanel panel = new JPanel(new MigLayout());;
JLabel label = new JLabel("Sample Label")
panel.add(label, "gaptop 20, gapbottom 20,wrap");
当我查看MigLayout文档时,上面的代码对我来说看起来是有效的,但在运行时它会抛出java.lang.ClassCastException异常,并带有下面的堆栈跟踪
java.lang.ClassCastException: java.lang.String cannot be cast to net.miginfocom.layout.CC
at com.intellij.ui.layout.migLayout.patched.MigLayout.addLayoutComponent(MigLayout.kt:403)
at java.awt.Container.addImpl(Container.java:1128)
at java.awt.Container.add(Container.java:973)
at com.xxx.size.plugin.MemoryMeasurementTool_Tool.loadToolResultPanel(xxxMeasurementTool_Tool.java:58)
at com.xxx.size.plugin.MemoryAnalyzer$1.run(xxxAnalyzer.java:75)
at jetbrains.mps.smodel.WorkbenchModelAccess$UndoContextSetup.run(WorkbenchModelAccess.java:378)
at jetbrains.mps.smodel.ActionDispatcher.dispatch(ActionDispatcher.java:84)
at jetbrains.mps.smodel.ActionDispatcher.lambda$wrap$0(ActionDispatcher.java:105)
at jetbrains.mps.smodel.ActionDispatcher.dispatch(ActionDispatcher.java:84)
at jetbrains.mps.smodel.ActionDispatcher.lambda$wrap$0(ActionDispatcher.java:105)
at jetbrains.mps.smodel.LockRunnable.run(LockRunnable.java:60)
at jetbrains.mps.smodel.TryRunPlatformWriteHelper.lambda$tryWrite$2(TryRunPlatformWriteHelper.java:122)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1057)
at jetbrains.mps.smodel.TryRunPlatformWriteHelper.runWrite(TryRunPlatformWriteHelper.java:103)
at jetbrains.mps.smodel.TryRunPlatformWriteHelper.tryWrite(TryRunPlatformWriteHelper.java:120)
at jetbrains.mps.smodel.WorkbenchModelAccess.lambda$tryWriteInCommand$4(WorkbenchModelAccess.java:226)
at jetbrains.mps.util.ComputeRunnable.compute(ComputeRunnable.java:32)
at jetbrains.mps.util.AbstractComputeRunnable.run(AbstractComputeRunnable.java:27)
一只萌萌小番薯
相关分类