Java JComponent paint --Almost working

后端 未结 3 1226
渐次进展
渐次进展 2021-01-16 19:04

I almost have the repaint() Jcomponent working. I had it working and then tried to make an absolute positioning and now it doesn\'t work.

import java.awt.Col         


        
3条回答
  •  佛祖请我去吃肉
    2021-01-16 19:36

    Another way to use the Timer class:

    Timer t = new Timer(510, new ActionListener()
    {
        @Override
        public void actionPerformed(ActionEvent e)
        {
            rectangle_x++;
            repaint();
        }
    })
    ...
    t.start();
    

    You still need to override actionPerformed() in your main class though.

提交回复
热议问题