public Object [] showDeleteTableOptions() { Vector listData = getListData();// This retrieves a vector containing the options listData.trimToSize(); int size = listData.size();
JCheckBox [] checkBoxes = new JCheckBox[size];
JPanel panel = new JPanel(); panel.setLayout(new GridLayout(size, 1));
for (int i=0; i< size; i++) { checkBoxes[i] = new JCheckBox(listData.get(i).toString()); panel.add(checkBoxes[i]); } int dialogResult = JOptionPane.showOptionDialog(this, new JScrollPane(panel), " Select table(s) to delete", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, okAllCancel, okAllCancel[0]);
if (dialogResult ==0 ) {// Process...} }
Question. Why doesn't the JScrollPane's scrollbar show when the panel contains a large list which is almost the height of the screen.