aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question regarding criteriaFind() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question regarding criteriaFind()" Watch "Question regarding criteriaFind()" New topic
Author

Question regarding criteriaFind()

Pratibha Gayake
Greenhorn

Joined: May 08, 2001
Posts: 29
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(){
try{
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(){
mainModel.setColumnNames(names);
mainModel.setTableRows(dInfo);
return (mainModel);
}
}
Pratibha
 
Consider Paul's rocket mass heater.
 
subject: Question regarding criteriaFind()