I'm trying to add some buttons in a JPanel from a comboBox. The comboBox has an array of 8 ints and when one of them is selected I want to be able to press a go button which will then display the number of buttons selected from the comboBox into a JPanel.
The JPanel is initially empty and the go button is disabled until something is selected.
I have created the JPanel, comboBox and the go button, but I'm now lost as to how to get and create the buttons.
The comboBox filled with Strings -
String[] floorStrings = {"Select one", "1", "2", "3", "4", "5", "6", "7", "8"};
//Create the combo box
JComboBox floorList = new JComboBox(floorStrings);
The actionPerformed code -
        public void actionPerformed(ActionEvent e) {
        floorList.getSelectedIndex();
        //int i = Integer.valueOf((String) floorList);
    if (e.getSource() == go) {
        go.setText("Stop");
        System.out.print("Clicked " + floorList);
        p3.add(go, BorderLayout.NORTH);
    } 
}
 
    