在 javafx 中使用 Swing 组件(如果它们不在 NetBeans javafx 调色板中)
我刚刚开始在 NetBeans 中使用 javafx,我让它做简单的事情(带有按钮的窗口等),但想尝试一些更实际的东西。
“Swing/AWT Components”面板有一大堆“JavaFX Script Code Clips”面板没有的东西(它有 Button、CheckBox、ComboBox、ComboBoxItem、Label、RadioButton、Slider、TextField 和 ToggleButton)。 如何向此调色板添加内容?
我想尝试使用 org-netbeans-swing-outline.jar 中的一些组件
编辑:啊哈。 我有点忽略了这一点:javafx.ext.Swing.* 中只有一些 javafx 包装的 Swing 组件可用,因此如果您想要其他 Swing 组件之一,则必须自己包装它们。
I'm just getting started with javafx in NetBeans, and I have it doing simple stuff (windows with buttons + the like) but would like to try something slightly more realistic.
The "Swing/AWT Components" palette has a whole bunch of stuff that the "JavaFX Script Code Clips" palette does not (it has Button, CheckBox, ComboBox, ComboBoxItem, Label, RadioButton, Slider, TextField, and ToggleButton). How do I add stuff to this palette?
I would like to try using some of the components in org-netbeans-swing-outline.jar
edit: Aha. I was missing the point somewhat: there are only some javafx-wrapped Swing components available in javafx.ext.Swing.*, so if you want one of the other Swing components you have to wrap them yourself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊哈,我想出了我需要做什么:
有一种方法可以 将 Swing 组件包装到 javafx 组件中使用
javafx.ext.swing.SwingComponent.wrap()
aha, I figured out what I needed to do:
There's a way to wrap Swing components into a javafx component using
javafx.ext.swing.SwingComponent.wrap()