如题,最好有完整的源码

解决方案 »

  1.   

    在JFrame里做个线程,实现慢慢上升的功能就可以了
      

  2.   

    public class MoveFrame extends JFrame implements Runnable{
           int posX,posY;
           int n=0;;
           long sleepTime=500;
           Thread t;
           public MoveFrame()
           {
            super("threadMove...");
            this.setSize(300,300);
            this.setVisible(true);
            posX=Toolkit.getDefaultToolkit().getScreenSize().width/2;
            posY=Toolkit.getDefaultToolkit().getScreenSize().height;
            this.setLocation(posX,posY);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            t=new Thread(this);
            t.start();
            
           }
           public void run()
           {
            while(n<this.getHeight())
            {
            posY-=100;
            this.setLocation(posX,posY);
            try{
            Thread.sleep(sleepTime);
            }
            catch(InterruptedException ie)
    {}
            n+=100;
            }
           }
           public static void main(String args[])
           {
            new MoveFrame();
           }
    }