swing - Java- TitledBorder in gridbag layout expanding as the window expands -
i making form using gridbag layout has titled border. first titledborder panel customer details works fine except know how add spacing between first title , textfield (eg first name) , following title , textfield (eg last name) below it. the problem second panel room details expands enlarge/expand window , happens, components inside shift. remain fixed components in first panel . this form.java class: public class form extends jframe{ jpanel pnl= new jpanel(); jpanel pnl1= new jpanel(); jlabel fname= new jlabel("first name: "); jlabel lname= new jlabel("last name: "); jlabel contact= new jlabel("contact number: "); jlabel email= new jlabel("email address: "); jlabel address= new jlabel("address: "); jlabel numpsns= new jlabel("number of persons: "); jtextfield fnamefield= new jtextfield(25); jtextfield lnamefield= new jtextfield(25); jtextfield contactfield= new jtextfield(25); jtextfield emailfield= new jtextf...