java JLabel超过另一个JLabel不工作
我一直在试着为我的流氓形象换一个。不幸的是,它似乎不起作用。以下是我目前的代码:
public void updateDraw(int direction){
int[] pos = Dungeon.getPos();
for(int i=pos[1]-(DISPLAY_Y_SIZE/2) ; i<pos[1]+(DISPLAY_Y_SIZE/2) ; i++){
for(int j=pos[0]-(DISPLAY_X_SIZE/2) ; j<pos[0]+(DISPLAY_X_SIZE/2) ; j++){
labelGrid[i-(pos[1]-(DISPLAY_Y_SIZE/2))][j-(pos[0]-(DISPLAY_X_SIZE/2))].setIcon(tiles[Dungeon.getMapTile(i,j)].getIcon());
}
}
labelGrid[DISPLAY_Y_SIZE/2][DISPLAY_X_SIZE/2].add(character);
this.repaint();
}
我读过一些其他问题的解决方案,它们都是通过简单地将JLabel添加到另一个问题中来实现的。它在这里不起作用,知道为什么吗
PS:我不想在我的JPanel上使用JLayeredPane
共 (0) 个答案