2
問題解決:使用錯誤的顏色包爲什麼我無法創建新的顏色?
我想讀取一些csv文件的值,當我把三個數字放在一起,他們形成一個rgb值。
然而,出於某種原因,我的IDE,Netbeans的,是給我的錯誤: 「新顏色(浮球,浮球,浮球)在類顏色的私人通道」
我不知道如何使用即使在將結果轉換爲整數後,parseInt也可以產生一個浮點數。
感謝您的時間和耐心。
public void initBasicRGB(String definitionCSVContent) {
String[] lines = definitionCSVContent.split("\n");
String[] values;
for (String s : lines) {
values = s.split(";");
if (!s.isEmpty() && values.length==6) {
int red = (int)Integer.parseInt(values[1]);
int green = (int)Integer.parseInt(values[2]);
int blue = (int)Integer.parseInt(values[3]);
String nameProvince = values[4];
basicRGB.put(new Color(red,green,blue), nameProvince);
//the error is on the line above
}
}
}
一個包basicRGB位於哪裏? –
同班同學 – BURNS
發佈您的整個班級 –