need help here plss.. and thanks in advance>>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class frmSearch extends JDialog
{
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
JPanel jpnlMain = new JPanel();
JButton bttnSearch = new JButton("Search", new ImageIcon("images/i16x16/search.png"));
JButton bttnExit = new JButton("Cancel", new ImageIcon("images/i16x16/exit.png"));
JLabel lblHeader = new JLabel();
JLabel lblIcon = new JLabel();
JLabel lblCaption = new JLabel("IMPORTANT: All Fields are required.");
JLabel lblSearchFor = new JLabel("Search For:");
JLabel lblSearchIn = new JLabel("Look In:");
JTextField txtSearchFor = new JTextField();
JComboBox cbSearchIn;
String sFilter;
clsSettings settings = new clsSettings();
public frmSearch(JFrame OwnerForm, String sSearch)
{
super(OwnerForm,true);
sFilter = sSearch;
String sCustomers[] ={"CustID", "TradeName", "TypeOfBus"};
String sSuppliers[] ={"SupID", "TradeName", "TypeOfBus"};
String sStockCat [] ={"stk_clas_Code", "stk_clas_Name","stk_clas_Desc"};
String sStockDesc[] ={"stk_ds_Code", "stk_ds_Desc","stk_clas_Name"};
String sBank[] ={"Acct_Code", "Bnk_Code", "Bnk_Code","Bnk_Code"};
String sUsers[] ={"Username", "EmployeeID", "Fullname", "Title"};
String sLogDetails[]={"Username", "Fullname", "Month", "Year"};
if(sFilter == "Customers") {cbSearchIn = new JComboBox(sCustomers);}
else if(sFilter == "Suppliers") {cbSearchIn = new JComboBox(sSuppliers);}
else if(sFilter == "Stock Category") {cbSearchIn = new JComboBox(sStockCat);}
else if(sFilter == "Stock Description") {cbSearchIn = new JComboBox(sStockDesc);}
else if(sFilter == "Bank Accounts") {cbSearchIn = new JComboBox(sBank);}
else if(sFilter == "Users") {cbSearchIn = new JComboBox(sUsers);}
else if(sFilter == "Log Details") {cbSearchIn = new JComboBox(sLogDetails);}
settings.setJComboBox(cbSearchIn,80,72,225,20);
settings.setJTextField(txtSearchFor,80,50,225,20);
//Set the Settings of JLable
lblHeader.setIcon(new ImageIcon("images/iCustom/iTools/Banner-Header.png"));
lblIcon.setIcon(new ImageIcon("images/i32x32/search.png"));
lblCaption.setFont(new Font("Dialog", Font.BOLD, 12));
lblCaption.setForeground(new Color(255,255,255,255));
settings.setJLabel(lblCaption,80,15,200,40);
settings.setJLabel(lblHeader,0,0,500,40);
settings.setJLabel(lblIcon,5,2,50,40);
settings.setJLabel(lblSearchFor,5,50,105,20);
settings.setJLabel(lblSearchIn,5,72,105,20);
//Set the Settings of JButton
settings.setJButton(bttnExit,200,100,100,24,"exit" ,"Unload Form");
settings.setJButton(bttnSearch,100,100,100,24,"sea rch","Search");
bttnExit.setMnemonic(KeyEvent.VK_C);
bttnSearch.setMnemonic(KeyEvent.VK_S);
bttnExit.addActionListener(JBActionListener);
bttnSearch.addActionListener(JBActionListener);
//Add ComboBox to JPanel
jpnlMain.add(cbSearchIn);
//Add TextField to JPanel
jpnlMain.add(txtSearchFor);
//Add JLabel to JPanel
jpnlMain.add(lblCaption);
jpnlMain.add(lblIcon);
jpnlMain.add(lblHeader);
jpnlMain.add(lblSearchFor);
jpnlMain.add(lblSearchIn);
//Add JButton to JPanel
jpnlMain.add(bttnExit);
jpnlMain.add(bttnSearch);
jpnlMain.setBackground(Color.gray);
jpnlMain.setLayout(null);
getContentPane().setLayout(new BorderLayout(0,0));
getContentPane().add(BorderLayout.CENTER, jpnlMain);
setSize(350,160);
setResizable(false);
setLocation((screen.width - 350)/2,((screen.height-160)/2));
}
}ActionListener JBActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String srcObj = e.getActionCommand(); if(srcObj=="search") { if (sFilter == ("Supliers")); { frmSuppliers.reloadRecord("SELECT * FROM tblSuppliers WHERE " + cbSearchIn.getSelectedItem().toString().replaceAll(" ", "") + " LIKE '%" + txtSearchFor.getText() + "%' ORDER BY SupplierID ASC"); dispose(); } } else if(srcObj=="exit"){dispose();}
};
}