简体   繁体   English

组件的Java AWT唯一ID

[英]Java AWT Unique IDs for Components

Is there anything in Java AWT that has a unique id for each component? Java AWT中是否每个组件都有唯一的ID? I need it to be similar to the AutomationId in the UI Automation library from C#. 我需要的是类似的AutomationID从C#中的UI自动化库。 It just needs to be unique among siblings. 它只需要在兄弟姐妹之间是唯一的即可。 It doesn't need to be globally unique. 它不必是全局唯一的。 I just need it so that I can save the path to a GUI component while it's running at some point, and then if I restart the application at a different time, I can find the component. 我只需要它,以便可以在某个GUI组件运行时将其保存到该路径,然后如果在其他时间重新启动该应用程序,则可以找到该组件。

Is this possible using Java AWT? 使用Java AWT是否可以?

我不知道任何标识符,但是通常布局取决于组件的顺序,因此您可以通过组件在其容器的getComponents数组中的索引来标识组件。

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

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