简体   繁体   English

将 java swing 与 libgdx 集成

[英]Integrating java swing with libgdx

Iam making a level editor for libgdx.but I want to use the java swing buttons.我正在为 libgdx.but 制作一个关卡编辑器,但我想使用 java swing 按钮。 how can I put the libgdx display inside a JFrame如何将 libgdx 显示放在 JFrame 中

LibGDX really isn't meant to work with swing components, but LibGDX does provide its own button classes like ImageButton or TextButton that you can use for the same purpose. LibGDX 实际上并不打算与摆动组件一起使用,但 LibGDX 确实提供了自己的按钮类,如 ImageButton 或 TextButton,您可以将它们用于相同的目的。 It does take a little bit more work to set them up because you need to provide the background image and font that the button uses.设置它们确实需要更多的工作,因为您需要提供按钮使用的背景图像和字体。

See the accepted answer here for how to setup text buttons:有关如何设置文本按钮的信息,请参阅此处接受的答案:

How to create a button in Libgdx? 如何在 Libgdx 中创建一个按钮?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM