dialog 里不可以加放大缩小按纽。
想把JFrame作成模态的话,去看Dialo的原代码

解决方案 »

  1.   

    做个类似与JDialog的东东,
    private class TableName extends JDialog {
        public TableName(JFrame f){
          super(f, "插入报表标题", true);
          setBounds(300,300,250,250);      JPanel JPc = new JPanel();
          JPc.setLayout(new GridLayout(6,2,2,2));
          JLabel Lname   = new JLabel("表  名  称 : ");
          JLabel lheadbg = new JLabel("背  景  色 : ");
          JLabel lheadfont =  new JLabel("字  体 : ");
          JLabel lheadfontcolor = new JLabel("字  体  颜  色 : ");
          JLabel lheadFontsize = new JLabel("字  体  大  小 : ");
          Lresult = new JLabel("");
          String[] ComboStr1 = {"宋体","黑体","隶书"};
          String[] ComboStr3 = {"白色","红色","兰色","绿色","黑色","黄色","紫色","橙色"};
          String[] ComboStr4 = {"黑色","红色","兰色","绿色","白色","黄色","紫色","橙色"};
          jheadbgcolor = new JComboBox(ComboStr3);
          jheadbgcolor.setActionCommand("headbgcolor");
          jheadbgcolor.addActionListener(new ActionSet("headbgcolor",null));      jheadfont = new JComboBox(ComboStr1);
          jheadfont.setActionCommand("jheadfont");
          jheadfont.addActionListener(new ActionSet("jheadfont",null));
          jheadfontcolor = new JComboBox(ComboStr4);
          jheadfontcolor.setActionCommand("headfontcolor");
          jheadfontcolor.addActionListener(new ActionSet("headfontcolor",null));
          String[] ComboStr2 = {"13","12","14","16","18","20","24","26","30","36","48","72"};
          jheadfontsize = new JComboBox(ComboStr2);
          jheadfontsize.setActionCommand("jheadfontsize");
          jheadfontsize.addActionListener(new ActionSet("jheadfontsize",null));
          TFname   = new JTextField();
          if(bisOpen){
            TFname.setText(ar.getHeadText(1));
          }
          jheadbutton = new JButton("生成标题");
          jheadbutton.setActionCommand("生成标题");
          jheadbutton.addActionListener(new ActionSet("生成标题",null));
          JPc.add(Lname).setFont(font);
          JPc.add(TFname).setFont(font);
          JPc.add(lheadbg).setFont(font);
          JPc.add(jheadbgcolor).setFont(font);
          JPc.add(lheadfont).setFont(font);
          JPc.add(jheadfont).setFont(font);
          JPc.add(lheadfontcolor).setFont(font);
          JPc.add(jheadfontcolor).setFont(font);
          JPc.add(lheadFontsize).setFont(font);
          JPc.add(jheadfontsize).setFont(font);
          JPc.add(jheadbutton).setFont(font);
          JPc.add(Lresult).setFont(font);
          getContentPane().add(JPc);
          show();    }  }
      

  2.   

    你这是想把dialog和frame的功能合起来嘛!~应该可以,但不太容易。毕竟各自的属性不同,用处也不同。