In GUI, I have two JComboBox where all the comboBox items are retrieved from two tables, which are title and time. In my current code, when the title is selected,  displayDate(selected); will get called since I have implemented addActionListener in Select comboBox. 
But this is not what I want. When this file is run, I want it straight away display the date based on the first item in Select JcomboBox. When the Select comboBox item changed, only the date changed. What would be the correct way to write? 
  public class BuyTicket {  
    static JFrame frame;
    JLabel title,lblMainDate,selectMovie,dateOfShow;
    JComboBox Select,Date;
    public JPanel createContentPane() throws IOException
    {
        title = new JLabel("CYBER CINEMA");
        Select = new JComboBox();
        Select.setLocation(115,90);
        Select.setSize(175, 20);
        try {   
            DatabaseConnection db=new DatabaseConnection();
            Connection connect=db.getConnection();
            String sql="Select title FROM movie";
            PreparedStatement ps=connect.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
            String name = rs.getString("title");
            Select.addItem(name);         
        }
    } catch (Exception e) {
        System.out.println("null");
    }
        Select.addActionListener(new ActionListener()
        {
    public void actionPerformed(ActionEvent event)
        {
         JComboBox comboBox=(JComboBox) event.getSource();
         Object selected = Select.getSelectedItem();
         displayDate(selected);
        }
    private void displayDate(Object selected) {
        // TODO Auto-generated method stub
          try { 
                Date.removeAllItems();
                DatabaseConnection db=new DatabaseConnection();
                Connection connect=db.getConnection();
                String sql="Select date FROM movie WHERE title = ?";
                PreparedStatement ps=connect.prepareStatement(sql);
                ps.setObject(1, selected);
                ResultSet rs = ps.executeQuery();
                while (rs.next()) {
                String date1 = rs.getString("date");
                DefaultComboBoxModel model = (DefaultComboBoxModel)Date.getModel();
                if (model.getIndexOf(date1) == -1)
                {
                    Date.addItem(date1);
                }
            }
        } catch (Exception e) {
            System.out.println("null");
        }
    }
        });
    }
Edited
public class BuyTicket {
    static JFrame frame;
    JLabel title,lblMainDate,selectMovie,dateOfShow;
    JComboBox Select,Date;
    public JPanel createContentPane() throws IOException
    {
        Select = new JComboBox();
        Select.setLocation(115,90);
        Select.setSize(175, 20);
        try {   
            DatabaseConnection db=new DatabaseConnection();
            Connection connect=db.getConnection();
            String sql="Select title FROM movie";
            PreparedStatement ps=connect.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
            String name = rs.getString("title");
            Select.addItem(name);         
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
        Select.addActionListener(new ActionListener()
        {
    public void actionPerformed(ActionEvent event)
        {
         JComboBox comboBox=(JComboBox) event.getSource();
         Object selected = Select.getSelectedItem();
         displayDate(selected);
        }
        });
        String getMovie = (String)Select.getSelectedItem(); // New code added, directly display the Date JComboBox items 
        System.out.println(getMovie);
        displayDate(getMovie);
        Date = new JComboBox();
        Date.setLocation(115,140);
        Date.setSize(175, 20);
    }
    private void displayDate(Object selected) {
        // TODO Auto-generated method stub
          try { 
                Date.removeAllItems();
                DatabaseConnection db=new DatabaseConnection();
                Connection connect=db.getConnection();
                String sql="Select date FROM movie WHERE title = ?";
                PreparedStatement ps=connect.prepareStatement(sql);
                ps.setObject(1, selected);
                ResultSet rs = ps.executeQuery();
                while (rs.next()) {
                String date1 = rs.getString("date");
                DefaultComboBoxModel model = (DefaultComboBoxModel)Date.getModel();
                if (model.getIndexOf(date1) == -1)
                {
                    Date.addItem(date1);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
I have added some code, but the Date still cannot directly display and I get a nullpointer error.
Latest Output
Angry Bird
java.lang.NullPointerException
    at gui.BuyTicket.displayDate(BuyTicket.java:131)
    at gui.BuyTicket.createContentPane(BuyTicket.java:87)
    at gui.BuyTicket.createAndShowGUI(BuyTicket.java:115)
    at gui.HomePage$2.mouseClicked(HomePage.java:151)
    at java.awt.Component.processMouseEvent(Unknown Source)

 
     
    