JComponent () { JPanel panel = new JPanel(new GridBagLayout()); GridBag gb = new GridBag().setDefaultInsets(4, 4, 4, 4).setDefaultWeightY(1).setDefaultFill(GridBagConstraints.BOTH); JLabel keyPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.abbreviation")); keyPrompt.setLabelFor(myKeyField); panel.add(keyPrompt, gb.nextLine().next()); panel.add(myKeyField, gb.next().weightx(1)); JLabel descriptionPrompt = new JLabel(CodeInsightBundle.message("dialog.edit.template.label.description")); descriptionPrompt.setLabelFor(myDescription); panel.add(descriptionPrompt, gb.next()); panel.add(myDescription, gb.next().weightx(3)); return panel; }