JavaFX中JComponent的替代 [英] Alternative for JComponent in JavaFX

查看:206
本文介绍了JavaFX中JComponent的替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JavaFX的新手,我最近在Google上搜索了一段时间以了解这一点. 我计划在Swing中的项目中重写现有的屏幕管理器框架. 我有兴趣了解FX中JComponent的替代方法是什么? 我是无法得出结论的是舞台或窗口,还是控件或父级.我也不确定是否有这样的选择.

I am new to JavaFX and i have been recently googling around for a while to understand this. I am planning to rewrite an existing screen-manager framework in my project which is in Swing. I am interested to understand what is the alternative to JComponent in FX ? Is it Stage or window or Control or Parent, i am not able to conclude. Neither i am sure if there is such an alternative any.

为什么我需要JComponent的替代品? 好吧,在我拥有的屏幕管理器框架中,我们总是将任何单独的挥杆组件(例如面板)的类型返回为JComponent.因此,我很想知道FX中的替代方法,如果有的话.

Why do i need the alternative for JComponent ? Well, in the screen-manager framework that i have in place, we always return the type for any individual swing component (say a panel) as JComponent. So i am eager to know the alternative in FX, if we have one.

在此先感谢您的帮助.

推荐答案

有些松散,相当于节点

我宽松地说,因为它们是不同的事物,并且不是100%的等价关系,但是我想您可以将它们视为大致代表相似的事物.节点比JComponents代表更多的东西,因为它们可以代表形状,媒体视图等.

I say loosely, because they are different things and it isn't a 100% equivalence relation, but I guess you can think of them as roughly representing similar things. Nodes represent more stuff than JComponents because they can represent shapes, media views, etc.

JComponent是:

JComponent is:

除顶级容器之外的所有Swing组件的基类.要使用从JComponent继承的组件,必须将该组件放置在根目录为顶级Swing容器的包含层次结构中.顶级Swing容器(例如JFrame,JDialog和JApplet)是专用组件,它们为其他Swing组件自己绘制提供了空间.

The base class for all Swing components except top-level containers. To use a component that inherits from JComponent, you must place the component in a containment hierarchy whose root is a top-level Swing container. Top-level Swing containers -- such as JFrame, JDialog, and JApplet -- are specialized components that provide a place for other Swing components to paint themselves.

节点是:

场景图节点的基类.场景图是一组树数据结构,其中每个项目具有零个或一个父项,并且每个项目要么是具有零个子项的叶",要么是具有零个或多个子项的分支".

Base class for scene graph nodes. A scene graph is a set of tree data structures where every item has zero or one parent, and each item is either a "leaf" with zero sub-items or a "branch" with zero or more sub-items.

请注意,场景包含在窗口(或

Note that a Scene is contained within a Window (or Stage), so somewhat analogous to a JComponent, a window is not a Node (but pretty much everything else that JavaFX displays is).

请参见Oracle的场景图教程有关什么是节点以及如何使用节点的更多信息.

See the Working with the Scene Graph tutorial from Oracle for more information on what Nodes are and how they are used.

这篇关于JavaFX中JComponent的替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆