下面的是它的代码,但用户框与密码框还有按钮,都离得太近了,想让它们拉开些距离,以便美观些,类似TOP的属性,有知道的吗?
function winCreate(){
 // 开启表单提示 
    Ext.QuickTips.init(); 
    // 设置提示信息位置为边上 
    Ext.form.Field.prototype.msgTarget = 'side'; 
    var win = new Ext.Window({ 
        id : 'login-win', 
        title : '学生管理系统-登录', 
        iconCls : 'tabs', 
        width : 300, 
        height : 300, 
        collapsible : true, 
        plain : true, 
        // 初始化表单面板 
        items : new Ext.form.FormPanel({ 
            id : 'login-form', 
            labelWidth :50, // 默认标签宽度板 
            labelAlign : 'right', 
            buttonAlign : 'center', 
            // 不设置该值,表单将保持原样,设置后表单与窗体完全融合 
            baseCls : 'header', 
            layout : 'form', 
            defaults : { 
                width : 200 
            }, 
            // 默认字段类型 
            defaultType : 'textfield', 
            items:[
                { 
                        id:'username', 
                        fieldLabel : '账号', 
                        allowBlank : false },
                   { 
                        id:'password',
                        inputType : 'password', 
                        fieldLabel : '密码', 
                        allowBlank : false }
             ], 
            // 初始化按钮 
            buttons : [{ 
                text : '登陆', 
                type : 'submit', 
                handler : function() { 
                    var but = this; 
                    but.setDisabled(true); 
                    this.setText('正在登陆'); 
                    // 将表单提交 
                    Ext.getCmp('login-form').getForm().submit({ 
                        url : '/XXX/login.action', 
                        method : "POST", 
                        success : function(form, action) { 
                            document.location = '/XXX/main.jsp'; 
                        }, 
                        failure : function() { 
                            but.setText("登陆"); 
                            but.setDisabled(false); 
                        } 
                    }); 
                } 
            }] 
        }) 
    }); 
    // 将窗口显示出来 
    win.show(); }

解决方案 »

  1.   

    items : new Ext.form.FormPanel({ 
      bodyStyle: "padding:10px",//加上这句
      id : 'login-form', 
      labelWidth :50, // 默认标签宽度板 
      labelAlign : 'right', 
      buttonAlign : 'center',  
      

  2.   

    你可以在form中嵌套panel组件然后再进行布局,总之是改变布局方式
      

  3.   

    把父容器设成layout:'absolute',
    然后控件可以用X:50,y:50, 坐标的方式去控制位置