Is there a way to add jcheckboxes into a jscrollpane?
I have an array of checkboxes and I want to add them into a Jscrollpane, which i will then add into a JOptionPane. So far I have this:
Object[] books = new Object[10000];
books[0] = "Choose books to purchase: ";
for(int l = 1;l<checkboxes.length;l++)
{
books[l] = checkboxes[l];
}
JList list = new JList(checkboxes);
//JTextPane test = new JTextPane();
//test.add(checkboxes[0]);
JScrollPane myScrollPane = new JScrollPane(list);
myScrollPane.setPreferredSize(new Dimension(250,250));
JOptionPane.showMessageDialog(null, "Choose the books you want to purchase below.\nPlease note that each book has a $5 shipping charge.\nThe books are formatted as Title - Author - Price", "Reminder",JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null,myScrollPane,"Book List",JOptionPane.OK_CANCEL_OPTION);
The output does not give me the checkboxes, just the pointer of the checkboxes i think. As you can see, I've tried putting the checkboxes into a JList but failed.
Thanks a lot guys!