如何在gridLayout中移动图像?

时间:2017-07-24 12:21:04

标签: java grid-layout

if(e.getSource() == UpButton) {
        kickBall("up");
    }
    else if(e.getSource() == mvDBtn){
        kickBall("down");
    }
    else if(e.getSource() == MvleftBtn){
        kickBall("right");
    }
    else if(e.getSource() == MvLbutton) {
        kickBall("left");
    }
    if(e.getSource() == runBtn) {
           timer1();
    }
     }
    public void kickBall(String a) {

        if(a == "right") {

            //how to move

        }
        else if(a == "left") {
            //how to move

        }
        else if(a == "up") {
            //how to move

        }
        else if(a == "down") {
          //how to move
        }

我有一个13 * 16的网格布局,我想移动一个玩家(角色)。它可以像素一样移动它,或者它应该一次移动网格单元格。

0 个答案:

没有答案