Re: adding a List of JTextField to the GUI



thufir wrote:

center.add(field); //Why isn't it adding??

center.setLayout(centerLayout);

I'm not sure, but reading your code I'll take a guess. You add the JTextFields to the JPanel's ("center") default FlowLayout, then you toss that away when you set a new layout manager to the new GroupLayout. Hence, the JPanel ends up with no components.

Try setting the layout manager before the for loop.
.



Relevant Pages

  • Re: adding a List of JTextField to the GUI
    ... You add the JTextFields to the JPanel's default FlowLayout, then you toss that away when you set a new layout manager to the new GroupLayout. ...
    (comp.lang.java.help)
  • Interested in a 10 question Java Quiz.
    ... FlowLayout. ... Which layout manager is the default for JFrame? ... d)The JComboBox expands to a list. ...
    (comp.lang.java.programmer)
  • Re: Box, Boxlayout problem
    ... > when the app runs the JTextFields and JLabels are all in the center!? ... should be documented in the layout manager or under Box. ...
    (comp.lang.java.programmer)
  • Re: Resizing a JLabel
    ... that is behaviour of FlowLayout. ... I find that the layout manager from JGoodies is much nicer. ... more powerful and can build much faster than GridBagLayout. ... where I use JGoodies LAF and Forms manager is at: ...
    (comp.lang.java.programmer)
  • Re: problems with setBounds
    ... > I have been trying to create a GUI placing Jbuttons and JTextFields where ... The default layout manager of a JPanel is FlowLayout. ...
    (comp.lang.java.gui)