谢谢各位大虾,饿是新手

解决方案 »

  1.   

    jdialog/jframe都可以啊setResizable(false)就可以了。
      

  2.   

    现在在窗体上画一个jbutton,然后给button添加action方法//主窗体
    import java.swing.*;public public class main extends JFrame{
       JButton jb = new JButton("新窗口");
       
       JPanel jp = new JPanel();   private void JBInit(){
            jp.add(jb);
            this.add("Center", jp);
            this.setSize(400, 130);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       }   public main() {
            try {
                addListener();
                JBInit();
            } catch (Exception exception) {
                exception.printStackTrace();
            }
        }   public static void main(String[] args) {
            main m = new main();
            m.setVisible(true);
       }   private void addListener(){
            jb.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    newFrame nf = new newFrame();
                    nf.setVisible(true);
                }
            });
       }
    }//新窗体
    import java.swing.*;public public class newFrame extends JFrame{   private void JBInit(){
            this.setSize(400, 130);
            this.setResizable(false);//禁止改变窗体大小
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       }   public newFrame() {
            JBInit();
        }
    }
      

  3.   

    在主窗体导包import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;不好意思
    刚才漏掉了
      

  4.   

    JFrame frame=new JFrame();
    frame.setResizable(false);
    就可以了