GUI 构建器如何工作?
我很好奇,GUI 构建器/设计器是如何工作的? 我的猜测(对于 Java),它实际上创建了一个 JFrame 并以某种方式覆盖了事件。 然而,这只是一个猜测。 您能提供一些见解吗?
I'm curious, how does a GUI builder/designer work? My guess ( for Java ), is that it actually creates a JFrame and overrides the events in some way. However, this is only a guess.
Can you offer some insight?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你太棒了......
在 Glade 中,允许你拖放组件的假窗口处理你的鼠标/键盘事件并进行后端调用以将 GUI 元素放置到位。 然后,这些元素被附加到处理程序,例如“单击按钮,转到源元素”。
当您仔细考虑时,这一切都非常微不足道。
查看林间空地来源可能会让您深入了解这是如何完成的。
IIRC,Glade 编写 XML,然后使用 libglade 将其呈现给设计者,而不是您实际创建元素。 您的事件构建包含 UI 元素和内部设计器处理程序的 XML 文件。
祝你好运
You are pretty much bang on ...
In Glade the fake-window that allows you to drag-and-drop components handles your mouse/keyboard events and makes the backend calls to put the GUI elements in place. These elements are then attached to handlers such as 'on click of button, goto the source element'
It is all pretty trivial when you think about it.
Looking at the glade source might give some insight into how that is done.
IIRC, Glade writes the XML and then renders that to the designer using libglade, rather than your d'n'ds actually creating the elements. Your events build XML files which contain the UI elements and internal designer handlers.
Good Luck