这是我代码的相关部分
package ReadWriteDisplayTriangles;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.collections;
class TrianglePane extends Pane{
private RecordTable recordTable;
//other code
public void setToRecordTable() {
ObservableList<Node> list = getChildren();
int size = list.size();
recordTable.setNewRecordArray(size);
for(int i = 0; i < size; i++) {
if(Debug.isDebug5() == true) {System.out.println("Observable list " + i + " is " + list.get(i)); }
}
}
}
这是javac -verbose的输出
[search path for class files: C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\resources.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\rt.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\sunrsasign.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\jsse.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\jce.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\charsets.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\jfr.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\classes,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\access-bridge-32.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\cldrdata.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\dnsns.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jaccess.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\localedata.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\nashorn.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\sunec.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\sunjce_provider.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\sunmscapi.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\sunpkcs11.jar,C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\zipfs.jar,.]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/scene/layout/Pane.class)]]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/scene/paint/Color.class)]]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/scene/shape/Polygon.class)]]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/event/ActionEvent.class)]]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/event/EventHandler.class)]]
TrianglePane.java:9: error: cannot find symbol
import javafx.collections;
^
symbol: class collections
location: package javafx
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/scene/layout/Region.class)]]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/scene/Parent.class)]]
[loading ZipFileIndexFileObject[C:\Program Files (x86)\Java\jdk1.8.0_241\jre\lib\ext\jfxrt.jar(javafx/scene/Node.class)]]
我有几个问题。
感谢您的投入,我是编码和爆炸新手。
问题来源:Stack Overflow
要导入完整的软件包,您需要使用*:
import javafx.collections.*;
或者,通过其名称导入该类:
import javafx.collections.ObservableList;
回答来源:Stack Overflow
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。