想做这样的一个窗口,在窗口中间调用applet显示动画效果,该如何做呢?

解决方案 »

  1.   

    import   java.awt.BorderLayout;   
      import   java.awt.event.*;   
      import   javax.swing.*;   
      public   class   MyApplet   extends   JApplet   
      {   
      public   void   init   ()   
      {   
      JButton   btnOK   =   new   JButton   ("OK");   
      final   JTextField   txt   =   new   JTextField   ();   
        
      btnOK.addActionListener   (new   ActionListener   ()   
      {   
      public   void   actionPerformed   (ActionEvent   arg0)   
      {   
      PopFrame   main   =   new   PopFrame   ();   
      main.setSize(200,   100);   
      main.setModal(true);   
      main.show();   
      String   strValue   =   main.getValue();   
      txt.setText(strValue);   
      }   
      });   
      getContentPane   ().add(txt,   BorderLayout.NORTH);   
      getContentPane   ().add(btnOK,   BorderLayout.SOUTH);   
      }   
        
      public   class   PopFrame   extends   JDialog   
      {   
      JTextField   txt   =   null;   
      JButton   btnOK   =   null;   
        
      PopFrame   ()   
      {   
      txt   =   new   JTextField   ();   
      getContentPane   ().add(txt,   BorderLayout.NORTH);   
      btnOK   =   new   JButton("OK");     
      getContentPane   ().add(btnOK,   BorderLayout.SOUTH);   
        
      btnOK.addActionListener   (new   ActionListener   ()   
      {   
      public   void   actionPerformed   (ActionEvent   arg0)   
      {   
      hide   ();   
      }   
      });   
      }   
        
      public   String   getValue   ()   
      {   
      return   (txt.getText());   
      }   
      }   
      } 
      

  2.   

    谢谢,现在不用applet用什么?