Here I made it quickly for you
public class GUI extends JFrame {
private JPanel contentPane;
public JButton btnNewButton;
public JComboBox<String> comboBox;
public GUI() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 148, 108);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
btnNewButton = new JButton("New button");
btnNewButton.addActionListener(ae -> setVisible(false));
btnNewButton.setBounds(20, 42, 89, 23);
contentPane.add(btnNewButton);
comboBox = new JComboBox<String>();
comboBox.setModel(new DefaultComboBoxModel<String>(new String[] {"Willow", "Yew"}));
comboBox.setBounds(10, 11, 121, 20);
contentPane.add(comboBox);
}
}
Also in your onStart
private int tree; //0 -> willow, 1 -> yew
public void onStart() {
GUI g = new GUI();
g.setVisible(true);
while(g.isVisible()) {}
tree = g.comboBox.getSelectedIndex();
}
And btw API has nothing to do with gui