在 Net Beans 的 JPanel 中绘制图表

发布于 2024-09-10 02:45:21 字数 203 浏览 2 评论 0原文

有没有可能的方法来重写 NetBeans 中自动生成的 GUI 代码中的 PaintComponent() 方法? 我设法在不使用拖放组件的情况下手动绘制图表,并且我需要进行调整(例如添加单选按钮组),我发现这确实非常耗时且乏味的工作。 我使用 NetBean 的拖放组件创建了一个 GUI,但无法编辑它们。是否可以?

请给我一个解决方案。 非常感谢任何见解 预先非常感谢

Is there a possible way to override the paintComponent() method in the auto-generated GUI code in NetBeans?
I managed to manually draw a graph without using the drag-and-drop components, and I need to make adjustments (e.g. adding radio button group) which I find really time consuming and tedious work.
I created a GUI using the NetBean's drag-and-drop components, but I cannot edit them. Is it possible?

Pls give me a solution.
Greatly apprecite any insight
Many thanks in advance

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

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

发布评论

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

评论(1

往事风中埋 2024-09-17 02:45:21

您可以覆盖用于创建组件的代码,并将该组件拖放到 NetBeans Swing UI“构建器”中的表单上。

您可以执行以下操作:

  1. 从选项板中选择一个组件。
  2. 放置元件。
  3. 右键单击该组件并选择“自定义代码”项。
  4. 在显示的对话框中编辑代码。

替代文本 http://www.freeimagehosting.net/uploads/4c75ea4390.png

是另一种自定义代码的方法,它有点复杂,但您可能会觉得有用。

当您拖放要自定义的组件时,请查看布局编辑器右侧的“属性”面板。您可以通过更改代码属性来自定义代码,例如“自定义创建代码”。

替代文本 http://www.freeimagehosting.net/uploads/4809b0fd4f.png

此答案中有关此方法的更多信息: 如何使用 NetBeans 修改/添加代码到 Java 中的 initComponents() 方法?

You can override the code used to create a component that you drag-and-drop onto a form in the NetBeans Swing UI 'builder'.

You can do the following:

  1. Select a component from the palette.
  2. Place the component.
  3. right click on the component and select the 'Customize code' item.
  4. Edit the code in the dialog that is displayed.

alt text http://www.freeimagehosting.net/uploads/4c75ea4390.png

There is another way to customize the code, that is a bit more complex, that you may find useful.

When you drag-and-drop a component that you wish to customize, look at the Properties panel on the right-hand side of the layout editor. You can customize code by altering the Code properties, like "Custom Creation Code".

alt text http://www.freeimagehosting.net/uploads/4809b0fd4f.png

There is more info about this method in this answer: How to modify/add code to the initComponents() method in Java using NetBeans?

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