you can start from something like this:
import java.awt.BorderLayout;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class UserInput extends JPanel{
JPanel checkBoxPanel = new JPanel();
public UserInput(){
int noOfCBReq = Integer.parseInt(
JOptionPane.showInputDialog("Enter the number of check boxes needed"));
JCheckBox[] cb = new JCheckBox[noOfCBReq];
for(int i=0; i<cb.length; i++){
JCheckBox checkBox = new JCheckBox();
checkBox.setText("Check box"+i);
checkBoxPanel.add(checkBox);
}
add(checkBoxPanel, BorderLayout.CENTER);
}
public static void main(String[] args){
JFrame f = new JFrame("User Input test");
f.getContentPane().add(new UserInput());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
}
}
Hope this helps
-R