Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ControlP5库中用于处理的.setBounds(int,int,int,int)存在问题_Java_Processing_Control P5 - Fatal编程技术网

Java ControlP5库中用于处理的.setBounds(int,int,int,int)存在问题

Java ControlP5库中用于处理的.setBounds(int,int,int,int)存在问题,java,processing,control-p5,Java,Processing,Control P5,我目前正在编辑库控件p5,以便在Eclipse上进行处理。问题是ControlWindow.java上总是出现意外错误: PApplet的方法.setBounds(int,int,int,int)未定义 以下是发生错误的方法的代码: public ControlWindow setUndecorated( boolean theFlag ) { if ( theFlag != isUndecorated( ) ) { isUndecorated = theFlag;

我目前正在编辑库控件p5,以便在Eclipse上进行处理。问题是ControlWindow.java上总是出现意外错误:

PApplet的方法.setBounds(int,int,int,int)未定义

以下是发生错误的方法的代码:

public ControlWindow setUndecorated( boolean theFlag ) {
    if ( theFlag != isUndecorated( ) ) {
        isUndecorated = theFlag;
        _myApplet.frame.removeNotify( );
        _myApplet.frame.setUndecorated( isUndecorated );
        _myApplet.setSize( _myApplet.width , _myApplet.height );
        _myApplet.setBounds( 0 , 0 , _myApplet.width , _myApplet.height );
        _myApplet.frame.setSize( _myApplet.width , _myApplet.height );
        _myApplet.frame.addNotify( );
    }
    return this;
}

此错误意味着
PApplet
类不包含此方法,如果您使用的是Processing 3,则此错误为真

setBounds()
是在Processing 2中找到的一种方法;用于从
java.applet
继承此方法的PApplet类,该类用于
扩展
。在Processing 3中,PApplet离开了Java小程序类,但controlp5源代码很旧,是用Processing 2而不是3构建的


setBounds()
方法指定帧的大小和左上角的位置

。。。这是Processing 3中现存的
setSize()
setPosition()
方法所涵盖的功能(实际上,发现错误的
setUndercorated()
方法已经调用了
setSize()


因此,删除该行以使库与Processing 3兼容,或者改用Processing 2。

Github上的相关行:克服问题代码量限制的一些更好的方法是将代码量减少到仅相关的(带有错误的方法+相关类变量定义)或粘贴完整的错误消息。或者两者都有:)为了解决这个问题,我只使用了_myApplet.frame.setBounds,它似乎可以工作