2

现在我有:

panel.getZoomButton().addActionListener(new ActionListener()
{
    @Override
    public void actionPerformed(ACtionEvent e)
    {
        zoom();
    }
}

每次按下缩放按钮时都会调用它。zoom()如果按住缩放按钮,如何更改它以便连续调用?

4

2 回答 2

4

You will need to use a MouseListener and override the mousePressed() method. There you can use a Timer or something similar to measure the time, the button has been pressed, in order to calculate your zoom.

Perhaps this question helps you with that: Java MouseEvent, check if pressed down

于 2013-02-26T16:13:15.453 回答
2
于 2013-02-26T16:24:06.173 回答