英文:
JavaFX equivalent of Swing SpringLayout
问题
我已经在使用Swing和SpringLayout一段时间了,我想知道JavaFX是否有与Swing SpringLayout 相当的功能,因为我计划很快将我的个人项目切换到JavaFX。
英文:
I've been working with Swing and SpringLayout for a while now and I want to know if JavaFX has equvalent of Swing SpringLayout, as I plan on swapping to JavaFX soon for my personal projects.
答案1
得分: 0
是的,您可以尝试这个链接:https://docs.oracle.com/javase/8/javafx/layout-tutorial/index.html
这是解决JavaFX中布局问题的示例。
英文:
Yes, u can try this https://docs.oracle.com/javase/8/javafx/layout-tutorial/index.html
It`s example to solve layout problem in javafx
答案2
得分: 0
JavaFX不是_Swing_。 JavaFX没有像_Swing_那样的LayoutManager
概念。在_Swing_中,你可以为JPanel
分配布局管理器,例如BorderLayout
,但在JavaFX中,你使用BorderPane
,它是一个使用特定布局的容器。我不知道JavaFX是否有像SpringLayout
一样可以布局其组件的容器,但我对此表示怀疑。可能的选择是使用GridPane。无论如何,其他回答中链接的教程可能会帮助您找到合适的容器。
请记住,您不能以与编写_Swing_相同的方式编写JavaFX。您需要适应JavaFX的工作方式。例如,JavaFX使用“绑定”,而_Swing_使用“监听器”。
英文:
JavaFX is not Swing. JavaFX does not have the concept of a LayoutManager
like Swing does. In Swing you assign a layout manager to a JPanel
, for example BorderLayout
, but in JavaFX you use a BorderPane
which is a container that uses a specific layout. I don't know whether JavaFX has a container that lays out its components like SpringLayout
does but I doubt it. Possibly, GridPane may be appropriate. In any case, the tutorial linked to in the other answer may help you discover an appropriate container.
Remember, you can't write JavaFX the same way you write Swing. You need to adapt to the JavaFX way of doing things. For example, JavaFX uses "bindings" while Swing uses "listeners".
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论