• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

populate data in text fields after selecting combo box list

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have problem with populating text fields upon selecting item in the combo box. I have 2 class, 1 to handle the GUI and the other, Controller to handle the database. Controller constructor takes the GUI as an input.
This is what I did in simplified version:
------------- GUI Class ------------
JComboBox combobox = new JComboBox();

public void comboboxListener(ActionListener al)
{
combobox.addActionListener(al);
}

-------------Controller---------------
Constructor:
GUI.comboboxListener(new combolistener());

class combolistener implements ActionListener{
public void actionPerformed(ActionEvent ae){
GUI.txt1.setText("");
GUI.txt2.setText("");
}
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic