title: java, How can I show a list when choose a item in the combobox(GUI)?
body: <p>I have a doubly linkedlist that contains <code>"Drivers","Tickets","Buses","Passengers"</code> info and I want to print if I choose a item in the combobox for example when I pick <code>driverlist</code>, use my print method to print the information, if its any way to show each list by a chooser, please tell me, thanks.</p>
  
  <pre><code> private static void Listframe() {
       JFrame f = new JFrame("Lists");
       String Lists[]={"Drivers","Tickets","Buses","Passengers"};
       JComboBox box = new JComboBox(Lists);
       JButton b = new JButton("show");
  
       JLabel label = new JLabel();
       f.setTitle("Lists");
       f.setForeground(Color.white);
       f.setBackground(Color.black);
       f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
       f.setSize(new Dimension(600,500));
       f.setLocation(new Point(20, 50));           
       f.setVisible(true);
       f.setLayout(new GridLayout(1,3));
       f.add(box);
       f.add(label);
       f.add(b);
       b.addActionListener(new ActionListener() {  
           public void actionPerformed(ActionEvent e) {
               String data = "picked list for: " + box.getItemAt(box.getSelectedIndex());  
               label.setText(data);
           }
       });
  }  
  </code></pre>