Дает ошибку если в actionPerformed(), но в init() работает.
Код | try{ img = getImage(getDocumentBase(), name); t = new MediaTracker(this); t.addImage(img, 0); t.waitForID(0); iw = img.getWidth(null); ih = img.getHeight(null); tw = iw / 12; th = ih / 12;
for(int y=0; y<12; y++){ for(int x=0; x<12; x++){ f = new CropImageFilter(tw*x, th*y, tw, th); //определили область fis = new FilteredImageSource(img.getSource(), f); //достали соурсы int i = y*12+x; //линия от 0 до 11, и т.д. cell[i] = createImage(fis); //создали картинку из вытащенных соурсов t.addImage(cell[i], i); //добавили фото в объект } } t.waitForAll(); //подождем пока все загрузятся if(t.checkID(143)){PhotoAreLoaded="yes"; repaint();} } catch(InterruptedException e){ }
|
|