Java 为什么;没有com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle,注册名称为:default";错误即将发生,如何修复?
当我编译LibGdx项目时,我得到以下异常 我的问题是,为什么会这样,以及如何解决这个问题 Libgdx:0.9.9Java 为什么;没有com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle,注册名称为:default";错误即将发生,如何修复?,java,json,libgdx,Java,Json,Libgdx,当我编译LibGdx项目时,我得到以下异常 我的问题是,为什么会这样,以及如何解决这个问题 Libgdx:0.9.9 com.badlogic.gdx.utils.GdxRuntimeException: No com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle registered with name: default Json文件 { com.badlogic.gdx.graphics.g2d.BitmapFont:
com.badlogic.gdx.utils.GdxRuntimeException: No com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle registered with name: default
Json文件
{
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } },
com.badlogic.gdx.graphics.Color: {
green: { a: 1, b: 0, g: 1, r: 0 },
white: { a: 1, b: 1, g: 1, r: 1 },
red: { a: 1, b: 0, g: 0, r: 1 },
black: { a: 1, b: 0, g: 0, r: 0 }
},
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } }
},
com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
default: { down: default-round-down, up: default-round },
toggle: { down: default-round-down, checked: default-round-down, up: default-round }
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: { down: default-round-down, up: default-round, font: default-font, fontColor: white },
toggle: { down: default-round-down, up: default-round, checked: default-round-down, font: default-font, fontColor: white, downFontColor: red }
},
com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
default: { font: default-font, fontColor: white, background: default-select, scrollStyle: default, listStyle: { font: default-font, selection: default-select-selection } }
},
com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: {
default-vertical: { handle: default-splitpane-vertical },
default-horizontal: { handle: default-splitpane }
},
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: { titleFont: default-font, background: default-window, titleFontColor: white },
dialog: { titleFont: default-font, background: default-window, titleFontColor: white, stageBackground: dialogDim }
},
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
default-horizontal: { background: default-slider, knob: default-slider-knob }
},
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
default: { font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor }
},
com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
default: { fontColorUnselected: white, selection: default-rect-pad, fontColorSelected: white, font: default-font }
},
com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle: {
default: { background: default-pane, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Tree$TreeStyle: {
default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection }
}
}
更新:我已经将我的项目libgdx更新为最新版本(夜间构建),现在我得到了不同的异常[com.badlogic.gdx.utils.GdxRuntimeException:Invalid line:],异常详细信息如下
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: images/uiskin.atlas
at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:178)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:222)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:217)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:207)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:202)
at com.pactpub.libgdx.canyonbunny.screens.MenuScreen.rebuildStage(MenuScreen.java:72)
at com.pactpub.libgdx.canyonbunny.screens.MenuScreen.show(MenuScreen.java:348)
at com.badlogic.gdx.Game.setScreen(Game.java:61)
at com.pactpub.libgdx.canyonbunny.CanyonBunnyMain.create(CanyonBunnyMain.java:15)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid line: <html class=" ">
at com.badlogic.gdx.graphics.g2d.TextureAtlas.readValue(TextureAtlas.java:426)
at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:111)
线程“LWJGL应用程序”com.badlogic.gdx.utils.GdxRuntimeException中的异常:读取包文件时出错:images/uiskin.atlas
位于com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData。(TextureAtlas.java:178)
位于com.badlogic.gdx.graphics.g2d.TextureAtlas。(TextureAtlas.java:222)
位于com.badlogic.gdx.graphics.g2d.TextureAtlas。(TextureAtlas.java:217)
位于com.badlogic.gdx.graphics.g2d.TextureAtlas。(TextureAtlas.java:207)
位于com.badlogic.gdx.graphics.g2d.TextureAtlas。(TextureAtlas.java:202)
位于com.pactpub.libgdx.canyonbuny.screens.MenuScreen.rebuildStage(MenuScreen.java:72)
在com.pactpub.libgdx.canyonbuny.screens.MenuScreen.show(MenuScreen.java:348)上
在com.badlogic.gdx.Game.setScreen上(Game.java:61)
在com.pactpub.libgdx.canyonbuny.canyonbunymain.create(canyonbunymain.java:15)
位于com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
位于com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
原因:com.badlogic.gdx.utils.GdxRuntimeException:无效行:
位于com.badlogic.gdx.graphics.g2d.TextureAtlas.readValue(TextureAtlas.java:426)
位于com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData。(TextureAtlas.java:111)
取自最新的测试结果
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle:{
默认值:{vScroll:default scroll,hScrollKnob:default round large,background:default rect,hScroll:default scroll,vScrollKnob:default round large}
},
尝试将其插入uiskin.json,它可能会起作用。不过,ScrollPane已经做了一些更改,可能无法再使用旧的0.9.9。您应该考虑使用最新版本的LBGDX(夜间构建)。显示您正在使用的JSON用于ScLabPANE的样式,以及Sur-Survior窗格的创建。否则我们需要一个新的大弹珠来看看你的代码。谢谢BenX!我已经用我正在使用的JSON文件进行了更新。我已经尝试过了,但不起作用。错误仍然存在!谢谢你的回答。我使用了最新版本(夜间版本),现在我得到了一个不同的例外。更新了问题中的异常详细信息。您是否正在使用我在回答中链接的测试文件夹中的所有文件?如果您使用uiskin.json、uiskin.atlas和uiskin.png,它应该可以工作。是的。我已经使用了所有的文件uiskin.atlas、uiskin.png和uiskin.json。但还是不行。天哪!是我的错!对不起@noone!我犯了一个错误,使用浏览器的“另存链接为”保存了这些文件,所有这些文件都保存为html文件。感谢您在libgdx上花费的时间和等待(“它应该可以工作”)!