• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question regarding criteriaFind()  RSS feed

Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to pass String criteria to criteriaFind method.
I construct this criteria string in Search class as per follwoing.
/* following is a Search class to populate the values from Database and construct the String criteria
public class Search extends JFrame implements ActionListener{
jlb1 = new JLabel("Origin airport");
jlb2 = new JLabel("Destination airport");
jcb1 = new JComboBox(fbn.getFlight());
jcb2 = new JComboBox(fbn.getFlight());
jb1 = new JButton("Search");
jb2 = new JButton("Clear");
/* all these components are added in a Panel using GridBgaLayout and added actionListener to "search" and "Clear" Buttons*/
public void actionPerformed(ActionEvent event){
Object source = event.getSource();
if(source == jb1){
sb = (jlb1.getText()+"='"+jcb1.getSelectedItem()+"',"+jlb2.getText()+"='" +jcb2.getSelectedItem()+"'");...................Line B
/* String sb is then passed to criteriaFind() method in FbnTableController class.
//FbnTableController class is as per following
public class FbnTableController{
private String[] names;
private DataInfo[] dInfo;
private FieldInfo[] field;
MainTableModel mainModel = new MainTableModel();
//This class only holds Data from database, and has getter and setter method.
public FbnTableController(){
dt= new Data("db.db");
dInfo = dt.criteriaFind(String sb);
//here I want to pass the String sb constructed in Search class. I am not bale to figure out how to pass String sb, which is constructed when "Search" button is pressed

field = dt.getFieldInfo();
names = new String[field.length];
for(int i=0;i<field.length;i++){>
System.out.println("field Name" +field[i].getName));
names[i] = field[i].getName();
catch(Exception e){}
public MainTableModel setDetails(){
return (mainModel);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!