gpt4 book ai didi

java - 如何访问JPanel?

转载 作者:行者123 更新时间:2023-12-01 15:37:56 25 4
gpt4 key购买 nike

我试图在 SingleFrameApplication 的 JPanel 中绘制一个简单的指针,0..360 度。我使用的是 NetBeans IDE 6.9.1,因为它有一个很好的 Swing 容器、控件、菜单等调色板。我希望 DrawPointer 接口(interface)是这样的,因为会有多个 [pointer]:

DrawPointer(JPanel panel, double degrees);

但是 JPanel 被 IDE 生成的代码声明为私有(private),如下所示:

public class MyView extends FrameView {
public MyView(SingleFrameApplication app) {
super(app);
initComponents();
...
private void initComponents() {
...
private javax.swing.JPanel jPanelA;
...

如果 JPanel 是私有(private)的,我如何访问它并在其中绘图?

最佳答案

如果您唯一关心的是私有(private),您可以在netbeans中更改它,

right click the component > customize code > at the bottom you have the option to change the declaration code.

关于java - 如何访问JPanel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8578423/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com