2016-12-17 35 views

回答

0

您發佈的代碼不完整,與您要求的內容很少有關。這說,假設圖像都具有相同的大小,這應該工作:

paintComponent(Graphics g) { 
    int x = 0; 
    int y = 0; 
    int w = worldMap[0][0].getWidth(); 
    int h = worldMap[0][0].getHeight(); 
    for(int r=0; r<WorldMap.length; r++) { 
    for(int c=0; c<WorldMap[r].length; c++) { 
     g.drawImage(WorldMap[r][c], x, y, this); 
     x += w; 
    } 
    y += h; 
    x = 0; 
    } 
}