如何从jpanel中提取信息

发布于 2024-10-21 05:36:53 字数 78 浏览 6 评论 0原文

我正在尝试一个名为白板共享的项目,其中我需要从面板获取信息,而该信息就像一些绘图,那么我如何从面板获取它。在该面板中,我正在绘制一些矩形圆圈。

I am trying a project called white board sharing in which I need to get the information from a panel and that information is like some drawings so how can I get it from a panel. In that panel I am drawing some rectangles circles.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

时光病人 2024-10-28 05:36:53

如果您想对鼠标事件做出反应,您可能需要研究 Java API 的以下部分。

MouseListener

MouseMotionListener

另外,如果您想对用户将鼠标移到绘制的元素上时触发的鼠标事件做出反应,您可能会对 Graphics2D 和实现 形状

In case you want to react on mouse events you might want to investigate the following sections of the Java API.

MouseListener

MouseMotionListener

Also if you want to react on mouse events that are triggered when the users moves his mouse over a drawn element you might be interested in Graphics2D and the classes that implement Shape.

暖风昔人 2024-10-28 05:36:53

您可以将 Graphics 对象传递给面板,以便它绘制所绘制的项目。

You can pass a Graphics object to the panel for it to paint the items that were drawn.

清旖 2024-10-28 05:36:53

将看板视为某种模型的视图可能会有所帮助,该模型记录了看板内容的抽象表示。作为一个具体示例,此 GraphPanel 有一个非常简单的模型仅包含一个 List 和一个 List。这两个成员可以按照教程。

It may help to think of the board as a view of some model that records an abstract representation of the board's content. As a concrete example, this GraphPanel has a very simple model containing nothing more than a List<Node> and a List<Edge>. These two members could be wrapped and serialized as discussed in this tutorial.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文