Kimberly Carroll

Greenhorn
+ Follow
since Nov 16, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kimberly Carroll

Hi -

I am having a message dialog show a list of checkboxes. The problem I'm having is that the checkboxes never show up. I put a dialog in a for loop and each checkbox shows up on a new dialog (this is the behavior I was looking for), but I want each checkbox to show up on one panel. My code is below. Can someone please help me get all checkboxes (there's 6 of them) on the panel?

Thanks,
~ Kim

Code:

private class EditViewFilter extends javax.swing.JDialog {
public EditViewFilter(ArrayList items) {
super(new cvtsc.util.editor.EditorFrame(null), "View Options Filter", true);
java.awt.Container filterPane = getContentPane();
javax.swing.JPanel panel = new javax.swing.JPanel(new java.awt.BorderLayout());

/* add checkboxes to panel */
// items are the checkboxes on the dialog
for (int i = 0; i < items.size(); i++) {
javax.swing.JCheckBox checkbox = new javax.swing.JCheckBox(items.get(i).toString(), true);
panel.add(checkbox);
//javax.swing.JOptionPane.showMessageDialog(null, checkbox);
}

filterPane.add(panel, java.awt.BorderLayout.CENTER);

javax.swing.JPanel filterPanel = new javax.swing.JPanel();
javax.swing.JButton ok = new javax.swing.JButton("OK");

ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
setVisible(false);
}
});

filterPanel.add(ok);
filterPane.add(filterPanel, java.awt.BorderLayout.SOUTH);
setContentPane(filterPane);
pack();
}
}
18 years ago