In the JCombobox are possible Routes for a train.I want to get the value of JCombobox based on the event handler and then use it in a class that uses a Database. This value will be a parameter for a Mysql query.I have succeeded in getting it,but can not use it. I'm not very experienced in java, I am doing something wrong. I have searched the site for similar problems, seen them but not understood them clearly.What am I missing?
//imports...
public class Cashier extends JFrame{
      //here is main...
 public Cashier(){
      //some Window code...
     final  String[] Routes = {"--Select--", "value1",....."valueN" };
     final JComboBox comboBox = new JComboBox(Routes);
     comboBox.addActionListener(new ActionListener() {
       /*-->*/ public String d; 
            public void WhereTo(String dest){
                 this.d=dest;                 
                   System.out.println(d); 
          // comes out correct!           
      /*I want d for use in DBaccess class as query parameter, by invoking 
        GetRoute()*/         
}            
         public void actionPerformed(ActionEvent e) {
                 int val = comboBox.getSelectedIndex();
                         this.d= Routes[val];    
              WhereTo(d);
        }         
     });
            comboBox.setBounds(165, 124, 130, 23);     
    contentPane.add(comboBox);
   //this method will be used by DBaccess
   public String GetRoute(){
     return d;                    
    }
    //More Objects...
  }
}
This is my DBaccess class where i want to use the string d, probably by invoking Get Route() of Cashier.
 public DBaccess extends Cashier{
  //connection code....
 // Executing the query
  System.out.println("Creating statement...");
  stmt = conn.createStatement();
  String sql; 
 //probably like this...   
 String go = Cashier.GetRoute();
  sql = "SELECT FROM reservations WHERE destination='"+go+"'";
  ResultSet rs = stmt.executeQuery(sql);
  }
 
     
     
    