在窗体中添加一个按钮通过单击按钮怎么连接到其他窗体中去!

解决方案 »

  1.   

    点击之后把另外的窗体NEW出来不就可以了
      

  2.   

    能不能写一下!我刚学JAVA还不太懂怎么写
      

  3.   

    import javax.swing.* ;
    import java.awt.* ;
    import java.awt.event.* ;public class Test extends JFrame
    {
    public Test()
    {
    this.setSize( 600, 480 ) ;
    this.setLayout( new FlowLayout() ) ;

    JButton jb = new JButton("打开新窗口") ;
    this.add( jb ) ;
    jb.addActionListener( new ActionListener() 
    {
    public void actionPerformed(ActionEvent e)
    {
    new Test() ; //换成你想打开的窗体
    }
    }) ;

    this.setVisible( true ) ;
    }

    public static void main( String args[] )
    {
    new Test() ;
    }
    }