Re: adding a List of JTextField to the GUI
- From: Mark Space <markspace@xxxxxxxxxxxxxx>
- Date: Sun, 27 Jul 2008 00:21:17 -0700
Mark Space wrote:
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.
Or I could be totally wrong. GroupLayout appears to work very differently from most layout managers. You don't add components to the container with add(). You use methods in the GroupLayout to add components and position them.
Better read up:
<http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html>
.
- Follow-Ups:
- Re: adding a List of JTextField to the GUI
- From: thufir
- Re: adding a List of JTextField to the GUI
- References:
- adding a List of JTextField to the GUI
- From: thufir
- Re: adding a List of JTextField to the GUI
- From: Mark Space
- adding a List of JTextField to the GUI
- Prev by Date: Re: adding a List of JTextField to the GUI
- Next by Date: Re: [NetBeans]changing menuitems
- Previous by thread: Re: adding a List of JTextField to the GUI
- Next by thread: Re: adding a List of JTextField to the GUI
- Index(es):
Relevant Pages
|