import javax.swing.*; public class AnimateJInternalFrame { JFrame jf=new JFrame(); JInternalFrame jif=new JInternalFrame(); Timer t; public AnimateJInternalFrame() { jf.setSize(700,700); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setLayout(null); jif.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jif.setLayout(null); jif.setBounds(50,50,300,300); jf.setVisible(true); jf.add(jif); t=new Timer(30,null); t.start(); for(int i=50;i<500;i++){ jif.setBounds(50,i,300,300); jif.setVisible(true); } } public static void main(String[] args) { new AnimateJInternalFrame(); } }
I want that JInternalFrame to animate smoothly downwards but it is'nt working.
Whats the problem with my code?