I have been trying to implement a partially Dynamically generated GUI but an having trouble with the layout not rendering properly. Simply resizing the window corrects the issue. Here is the problimatic generation code:
public void setupBookTabs() {
ArrayList<String> bookTabNames = Record.getBookGroups();
for (int i = 0; i < bookTabNames.size(); i++) {
JPanel jPanel = new JPanel();
jPanel.setName(bookTabNames.get(i));
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.PAGE_AXIS));
ArrayList<Book> bookGroup = Record.getBooksByGroup(bookTabNames.get(i));
for (int k = 0; k < bookGroup.size(); k++) {
JPanel innerPanel = new JPanel();
innerPanel.setName(bookGroup.get(k).getName());
innerPanel.setSize(new Dimension(1, 1));
innerPanel.setLayout(new WrapLayout());
for (int j = 0; j < bookGroup.get(k).getNumberOfSections(); j++) {
Section s = bookGroup.get(k).getSection(j);
JPanel group = new JPanel();
group.setName(s.getName());
JCheckBox box = new JCheckBox();
box.setText(s.getName());
group.add(box);
JFormattedTextField date = new JFormattedTextField(new SimpleDateFormat("mm/dd/yyyy"));
date.setEditable(false);
if (s.getCompletionDate() != null) {
date.setText(s.getCompletionDate().getMonth() + "//" + s.getCompletionDate().getDate() + "//" + s.getCompletionDate().getYear());
}
group.add(date);
innerPanel.add(group);
}
jPanel.add(innerPanel);
JSeparator separator = new JSeparator();
separator.setVisible(true);
jPanel.add(separator);
}
JScrollPane scrollPane = new JScrollPane(jPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setName(bookTabNames.get(i));
tabs.add(scrollPane);
}
}