I'm having problems
I have a frame that has a textField, button, label.
The button is used to diplay the Jtable which has the resultSet.
My query is:
String query = "SELECT personID, firstName, surname FROM Person where firstName
= '" + jTxtTest.getText() + "'";
If I enter Gita in the textField and press the button it should display the
personID, firstName, surname where firtsname = Gita
in the Jtable and also display Gita in the label.
But it only display Gita in the Label but noting in the Jtable.
What am i doing wrong?????
public class Frame1 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();;
String driver="sun.jdbc.odbc.JdbcOdbcDriver";
String url="jdbc:odbc:myDatabase";
String tempname = "";
int tempcnt;
JTabbedPane tabbedPane = new JTabbedPane();
Object[] data = new Object[20];
DefaultTableModel defaulttablemodel = new DefaultTableModel();
JTable jtable = new JTable(defaulttablemodel);
JPanel p1 = new JPanel();
JTabbedPane jTabbedPane1 = new JTabbedPane();
JPanel jPanel1 = new JPanel();
JTextField jTxtTest = new JTextField();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
//=========================================================== START MenuItemHandler
======
class MenuItemHandler implements ActionListener
{
public void actionPerformed(ActionEvent ev)
{
String s=ev.getActionCommand();
if(s=="Exit")
{
System.exit(0);
}
else if (s=="Preview")
{
///
}
}
}
/**Overridden so we can exit when window is closed*/
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}