private void addLine(int line,JLabel label,JComponent field){
  gbc.gridy=line;
  gbc.insets=labelInsets;
  gbc.gridx=0;
  gbc.weightx=0.0;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  label.setHorizontalAlignment(SwingConstants.RIGHT);
  mainPanel.add(label,gbc);
  gbc.insets=fieldInsets;
  gbc.gridx=1;
  gbc.weightx=1.0;
  gbc.fill=GridBagConstraints.NONE;
  gbc.insets=fieldInsets;
  mainPanel.add(field,gbc);
}

private void addLine ( int line , JLabel label , JComponent field ) { gbc . gridy = line ; gbc . insets = labelInsets ; gbc . gridx = 0 ; gbc . weightx = 0.0 ; gbc . fill = GridBagConstraints . HORIZONTAL ; label . setHorizontalAlignment ( SwingConstants . RIGHT ) ; mainPanel . add ( label , gbc ) ; gbc . insets = fieldInsets ; gbc . gridx = 1 ; gbc . weightx = 1.0 ; gbc . fill = GridBagConstraints . NONE ; gbc . insets = fieldInsets ; mainPanel . add ( field , gbc ) ; }
add line to screen
