Problem repaint ( Refresh ) window

Hi Friends,
I have GUI JFrame window , in which i have added
combo box and add button when i click add one new JFrame window
opens and ask for name and when click OK, that is added to database.
1) Main Window in which add button is there
2) Secondary JFrame inputs the Username
Now i want to show name should be added in Main Window's combo
while clicking the Secondary windows OK button.
How can I repaint thing ??
I tried
panel.updateUI( )but still it not showing me new added name.
When i close application and restart it , it will showing me last added name , but it should not be the solution.
HELP.

MyExpenseTracker.java
(Main Class)
* MyExpenseTracker.java
* Created on October 11, 2007, 6:10 PM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package app;
import app.AddNewItem;
import java.util.*;
* @author Administrator
public class MyExpenseTracker
    /** Creates a new instance of MyExpenseTracker */
    public MyExpenseTracker()
    public static void main(String args[])   
            ExpTracker t = new ExpTracker();
            MyExpenseTracker mymain = new MyExpenseTracker();
            //LoginForm loginf = new LoginForm();
            t.setVisible(true);
}ExpTracker.java ( Main Window for project - no main method )
* ExpTracker.java
* Created on October 11, 2007, 1:39 PM
package app;
import app.AddNewItem;
import app.AddNewName;
import java.sql.*;
import java.text.*;
import java.util.*;
* @author  Administrator
public class ExpTracker extends javax.swing.JFrame
    /** Creates new form ExpTracker */
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    String query;
    int status =0;
    String URL="jdbc:mysql://localhost:3306/exptracker";
    String DRIVER ="com.mysql.jdbc.Driver";
    //String user =loginf.getAuthenticatedUser();
    Calendar cal = Calendar.getInstance();
    int day = cal.get(Calendar.DATE);
    int month = cal.get(Calendar.MONTH)+1;
    int year = cal.get(Calendar.YEAR);
    public ExpTracker()
        super("Expense Tracker v1.0");
        initComponents();
        //System.out.println("User name got :"+user);
        //javax.swing.JOptionPane.showMessageDialog(this,"Username:"+ user);
        //System.out.println("user :"+user);
        loadNameCombo();
        cmbdate.setSelectedItem(day);
        cmbmonth.setSelectedIndex(month-1);
        cmbyear.setSelectedItem(year);
    public void doConnection()
        //make connection
        try
            Class.forName(DRIVER).newInstance();
        catch(Exception e)
        { System.out.println("driver not found"+e.getMessage());     }
        //making query
        try
            con = DriverManager.getConnection(URL, "root", "");
            stmt = con.createStatement();
        catch(Exception e)
        { System.out.println("Connection Failure !"+ e.getMessage());  }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
    private void initComponents()
        jp1 = new javax.swing.JPanel();
        lbldate = new javax.swing.JLabel();
        cmbdate = new javax.swing.JComboBox();
        cmbmonth = new javax.swing.JComboBox();
        cmbyear = new javax.swing.JComboBox();
        lblfixdate = new javax.swing.JLabel();
        lblitem = new javax.swing.JLabel();
        cmbitem = new javax.swing.JComboBox();
        lblqty = new javax.swing.JLabel();
        tfqty = new javax.swing.JTextField();
        lblprice = new javax.swing.JLabel();
        tfprice = new javax.swing.JTextField();
        lblqtyfix = new javax.swing.JLabel();
        lblpricefix = new javax.swing.JLabel();
        btnAdd = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        lblname = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        ta = new javax.swing.JTextArea();
        btnReport = new javax.swing.JButton();
        btnAddRecord = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        cmbname = new javax.swing.JComboBox();
        btnAddname = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        menu = new javax.swing.JMenu();
        menu1exit = new javax.swing.JMenuItem();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jp1.setBorder(javax.swing.BorderFactory.createTitledBorder("Expense Detail"));
        lbldate.setFont(new java.awt.Font("Tahoma", 0, 10));
        lbldate.setText("Date :");
        cmbdate.setFont(new java.awt.Font("Tahoma", 0, 10));
        for(int i=1; i<=31; i++)
            cmbdate.addItem(i);
        cmbmonth.setFont(new java.awt.Font("Tahoma", 0, 10));
        cmbmonth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }));
        cmbyear.setFont(new java.awt.Font("Tahoma", 0, 10));
        for(int i=2006; i<=2050; i++)
            cmbyear.addItem(i);
        lblfixdate.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblfixdate.setText("*Format is dd-MM-yyyy");
        lblitem.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblitem.setText("Item :");
        cmbitem.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblqty.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblqty.setText("Quantity :");
        tfqty.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblprice.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblprice.setText("Price :");
        tfprice.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblqtyfix.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblqtyfix.setText("*you can write like 2 ,3 or 300gm");
        lblpricefix.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblpricefix.setText("*ex. 300, 13.50 etc. no characters");
        btnAdd.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnAdd.setText("Add");
        btnAdd.addActionListener(new java.awt.event.ActionListener()
            public void actionPerformed(java.awt.event.ActionEvent evt)
                btnAddActionPerformed(evt);
        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 10));
        jLabel1.setText("*if item is not in list, click Add button");
        org.jdesktop.layout.GroupLayout jp1Layout = new org.jdesktop.layout.GroupLayout(jp1);
        jp1.setLayout(jp1Layout);
        jp1Layout.setHorizontalGroup(
            jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jp1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jp1Layout.createSequentialGroup()
                        .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, lblitem, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, lbldate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 44, Short.MAX_VALUE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jp1Layout.createSequentialGroup()
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(cmbdate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(cmbmonth, 0, 59, Short.MAX_VALUE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(cmbyear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(jp1Layout.createSequentialGroup()
                                .add(10, 10, 10)
                                .add(lblfixdate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 119, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(cmbitem, 0, 168, Short.MAX_VALUE)
                            .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)))
                    .add(jp1Layout.createSequentialGroup()
                        .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(lblqty)
                            .add(lblprice))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(tfprice, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                            .add(tfqty, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE)
                            .add(lblqtyfix, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
                            .add(lblpricefix, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE))))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnAdd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
                .addContainerGap())
        jp1Layout.setVerticalGroup(
            jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jp1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(lbldate)
                    .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(cmbyear, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(cmbdate, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(cmbmonth, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(5, 5, 5)
                .add(lblfixdate)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(lblitem)
                    .add(cmbitem, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btnAdd))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(lblqty)
                    .add(tfqty, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(1, 1, 1)
                .add(lblqtyfix)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jp1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(lblprice)
                    .add(tfprice, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(lblpricefix)
                .addContainerGap(41, Short.MAX_VALUE))
        lblname.setFont(new java.awt.Font("Tahoma", 0, 10));
        lblname.setText("Name :");
        ta.setColumns(20);
        ta.setLineWrap(true);
        ta.setRows(5);
        jScrollPane1.setViewportView(ta);
        btnReport.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnReport.setText("Report");
        btnAddRecord.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnAddRecord.setText("Add New Expense");
        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 10));
        jLabel2.setText("Comments :");
        cmbname.addFocusListener(new java.awt.event.FocusAdapter()
            public void focusGained(java.awt.event.FocusEvent evt)
                cmbnameFocusGained(evt);
        btnAddname.setFont(new java.awt.Font("Tahoma", 0, 10));
        btnAddname.setText("Add");
        btnAddname.addActionListener(new java.awt.event.ActionListener()
            public void actionPerformed(java.awt.event.ActionEvent evt)
                btnAddnameActionPerformed(evt);
        menu.setText("File");
        menu1exit.setText("Exit");
        menu1exit.addActionListener(new java.awt.event.ActionListener()
            public void actionPerformed(java.awt.event.ActionEvent evt)
                menu1exitActionPerformed(evt);
        menu.add(menu1exit);
        jMenuBar1.add(menu);
        setJMenuBar(jMenuBar1);
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jp1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(10, 10, 10)
                        .add(btnReport, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 102, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(28, 28, 28)
                        .add(btnAddRecord, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 158, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .add(lblname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(15, 15, 15)
                        .add(cmbname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 194, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(btnAddname, 0, 0, Short.MAX_VALUE)
                        .add(28, 28, 28)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 253, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .add(39, 39, 39)
                        .add(jLabel2)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane1))
                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                        .add(20, 20, 20)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(lblname)
                            .add(cmbname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(btnAddname))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jp1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btnReport)
                    .add(btnAddRecord))
                .addContainerGap(15, Short.MAX_VALUE))
        pack();
    }// </editor-fold>                       
    private void cmbnameFocusGained(java.awt.event.FocusEvent evt)                                   
// TODO add your handling code here:
       this.jp1.updateUI();
    public void loadNameCombo()
        doConnection();
        try{
            query ="select name from name_master";
            rs = stmt.executeQuery(query);
            while(rs.next())
                cmbname.addItem(rs.getString("name"));
        }catch(Exception e){ e.printStackTrace(); }
         // this.repaint();    
    public void reloadComboName()
        cmbname.removeAllItems();
        loadNameCombo();
        this.repaint();
    public void loadItemCombo()
        doConnection();
        try{
            query ="select item_name from item_master";
            rs = stmt.executeQuery(query);
            while(rs.next())
                cmbitem.addItem(rs.getString("item_name"));
        }catch(Exception e){ e.printStackTrace(); }
    private void btnAddnameActionPerformed(java.awt.event.ActionEvent evt)                                          
// TODO add your handling code here:
        AddNewName n = new AddNewName();
        n.setVisible(true);
    private void btnAddActionPerformed(java.awt.event.ActionEvent evt)                                      
// TODO add your handling code here:
        AddNewItem i = new AddNewItem();
        i.setVisible(true);
    private void menu1exitActionPerformed(java.awt.event.ActionEvent evt)                                         
        // TODO add your handling code here:
         System.out.println("Current :"+ day +":"+month+":"+year);
}AddNewName.java
* AddNewName.java
* Created on October 13, 2007, 2:52 PM
package app;
import app.ExpTracker;
import java.sql.*;
import java.util.Vector;
* @author  Administrator
public class AddNewName extends javax.swing.JFrame
    /** Creates new form AddNewName */
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    String query;
    int status =0;
    String URL="jdbc:mysql://localhost:3306/exptracker";
    String DRIVER ="com.mysql.jdbc.Driver";
    public AddNewName()
        initComponents();
    public void doConnection()
        //make connection
        try
            Class.forName(DRIVER).newInstance();
        catch(Exception e)
        { System.out.println("driver not found"+e.getMessage());     }
        //making query
        try
            con = DriverManager.getConnection(URL, "root", "");
            stmt = con.createStatement();
        catch(Exception e)
        { System.out.println("Connection Failure !"+ e.getMessage());  }
    public void doInsert()
        String name2add = tfnameadd.getText().trim();
        query = "INSERT INTO name_master(name) VALUES ('"+name2add+"')";
        System.out.println("QUERY:"+query);
        try
           status = stmt.executeUpdate(query);
           //System.out.println("Query Status :"+status);
           //con.commit();
        } catch (SQLException ex)
            ex.printStackTrace();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
    private void initComponents()
        jPanel1 = new javax.swing.JPanel();
        lblnewname = new javax.swing.JLabel();
        tfnameadd = new javax.swing.JTextField();
        btnaddname = new javax.swing.JButton();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Add New Name"));
        lblnewname.setText("Enter Name :");
        tfnameadd.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        btnaddname.setText("Add Name");
        btnaddname.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        btnaddname.addActionListener(new java.awt.event.ActionListener()
            public void actionPerformed(java.awt.event.ActionEvent evt)
                btnaddnameActionPerformed(evt);
        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(btnaddname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 108, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(lblnewname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(37, 37, 37)
                        .add(tfnameadd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 218, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(20, Short.MAX_VALUE))
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(lblnewname)
                    .add(tfnameadd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnaddname, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                .addContainerGap())
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        pack();
    }// </editor-fold>                       
    private void btnaddnameActionPerformed(java.awt.event.ActionEvent evt)                                          
// TODO add your handling code here:
        ExpTracker et = new ExpTracker();
         doConnection();
         doInsert();
            if(status == 1)
                javax.swing.JOptionPane.showMessageDialog(this,"Record Inserted Successfully.");
                this.setVisible(false);
                et.repaint();
                et.reloadComboName();
                //this.repaint();
            else
                javax.swing.JOptionPane.showMessageDialog(this,"Record Failed to Insert.","Error",2);
     * @param args the command line arguments
    // Variables declaration - do not modify                    
    private javax.swing.JButton btnaddname;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblnewname;
    private javax.swing.JTextField tfnameadd;
    // End of variables declaration                  
}AddNewItem.java
* AddNewItem.java
* Created on October 13, 2007, 2:19 PM
package app;
import java.sql.*;
import java.util.*;
* @author  Administrator
public class AddNewItem extends javax.swing.JFrame
    /** Creates new form AddNewItem */
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    String query;
    int status =0;
    String URL="jdbc:mysql://localhost:3306/exptracker";
    String DRIVER ="com.mysql.jdbc.Driver";
    public AddNewItem()
        super("Add New Item");
        initComponents();
    public void doConnection()
        //make connection
        try
            Class.forName(DRIVER).newInstance();
        catch(Exception e)
        { System.out.println("driver not found"+e.getMessage());     }
        //making query
        try
            con = DriverManager.getConnection(URL, "root", "");
            stmt = con.createStatement();
        catch(Exception e)
        { System.out.println("Connection Failure !"+ e.getMessage());  }
    public void doInsert()
        String item2add = tfadditem.getText().trim();
        query = "INSERT INTO item_master(item_name) VALUES ('"+item2add+"')";
        System.out.println("QUERY:"+query);
        try
           status = stmt.executeUpdate(query);
           //System.out.println("Query Status :"+status);
           //con.commit();
        } catch (SQLException ex)
            ex.printStackTrace();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
    private void initComponents()
        jPanel1 = new javax.swing.JPanel();
        lblitemname = new javax.swing.JLabel();
        tfadditem = new javax.swing.JTextField();
        btnAddItem = new javax.swing.JButton();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setAlwaysOnTop(true);
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Add New Item"));
        lblitemname.setText("Item to add :");
        tfadditem.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        btnAddItem.setText("Add Item");
        btnAddItem.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        btnAddItem.addActionListener(new java.awt.event.ActionListener()
            public void actionPerformed(java.awt.event.ActionEvent evt)
                btnAddItemActionPerformed(evt);
        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(18, 18, 18)
                .add(jPanel1Layout.createParallelGroup(org.jd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Preventing applet from repainting/refreshing on resize

    hi,
    anyone has any idea on how one can prevent an applet from repainting the GUI screen when the applet is resized (minimized, maximized etc). i have a chat applet, but whenever the applet is minimized, all the present chat transcripts are lost and a new/refreshed window is displayed. how can we prevent this from happening? in effect, i want my applet to be displayed in the same state as it was before it was minimized.
    is there something i am missing?
    thanks,
    Satyen

    hi all,
    is this doubt really difficult, or i am missing something so very obvious, that no one out there wants to point it out.
    any suggestions would be very helping. and please, i am not looking for code snippets, any pointers/suggestions to the solution of the problem would suffice.
    thanks,
    Satyen.

  • Problem in refreshing JTree inside Jscrollpane on Button click

    hi sir,
    i have problem in refreshing JTree on Button click inside JscrollPane
    Actually I am removing scrollPane from panel and then again creating tree inside scrollpane and adding it to Jpanel but the tree is not shown inside scrollpane. here is the dummy code.
    please help me.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.tree.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    public class Test
    public static void main(String[] args)
         JFrame jf=new TestTreeRefresh();
         jf.addWindowListener( new
         WindowAdapter()
         public void windowClosing(WindowEvent e )
         System.exit(0);
         jf.setVisible(true);
    class TestTreeRefresh extends JFrame
         DefaultMutableTreeNode top;
    JTree tree;
         JScrollPane treeView;
         JPanel jp=new JPanel();
         JButton jb= new JButton("Refresh");
    TestTreeRefresh()
    setTitle("TestTree");
    setSize(500,500);
    getContentPane().setLayout(null);
    jp.setBounds(new Rectangle(1,1,490,490));
    jp.setLayout(null);
    top =new DefaultMutableTreeNode("The Java Series");
    createNodes(top);
    tree = new JTree(top);
    treeView = new JScrollPane(tree);
    treeView.setBounds(new Rectangle(50,50,200,200));
    jb.setBounds(new Rectangle(50,300,100,50));
    jb.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
              jp.remove(treeView);
              top =new DefaultMutableTreeNode("The Java ");
    createNodes(top);
              tree = new JTree(top);
                   treeView = new JScrollPane(tree);
                   treeView.setBounds(new Rectangle(50,50,200,200));
                   jp.add(treeView);     
                   jp.repaint();     
    jp.add(jb);     
    jp.add(treeView);
    getContentPane().add(jp);
    private void createNodes(DefaultMutableTreeNode top) {
    DefaultMutableTreeNode category = null;
    DefaultMutableTreeNode book = null;
    category = new DefaultMutableTreeNode("Books for Java Programmers");
    top.add(category);
    book = new DefaultMutableTreeNode("The Java Tutorial: A Short Course on the Basics");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Tutorial Continued: The Rest of the JDK");
    category.add(book);
    book = new DefaultMutableTreeNode("The JFC Swing Tutorial: A Guide to Constructing GUIs");
    category.add(book);
    book = new DefaultMutableTreeNode("Effective Java Programming Language Guide");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Programming Language");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Developers Almanac");
    category.add(book);
    category = new DefaultMutableTreeNode("Books for Java Implementers");
    top.add(category);
    book = new DefaultMutableTreeNode("The Java Virtual Machine Specification");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Language Specification");
    category.add(book);
    }

    hi sir ,
    thaks for u'r suggession.Its working fine but the
    properties of the previous tree were not working
    after setModel() property .like action at leaf node
    is not working,I'm sorry but I don't understand. I think you are saying that the problem is solved but I can read it to mean that you still have a problem.
    If you still have a problem then please post some code (using the [code] tags of course).

  • Repainting VI windows

    Hallo LV'ers,
    I'm running LV5.1.1. I have an application where I have a parent window
    which stays the same all the time. Within this parent window I display
    different child windows in a sequence. Each of the childs is docked to the
    parent by means of some WinAPI functions like SetParent (I'm using the
    G-Toolbox). It works fine. Now the problem: Every time a child is docked to
    the parent, the entire parent window is repainted, even the parts of it
    which are left unchanged. That causes the screen to flicker in a not very
    nice way.
    Is there a way to define the region of the parent window to be repainted, so
    that only the region of the childs are repainted. I know of this commands in
    the WinAPI, but how can I do this in LV ? Do I have t
    o use WinAPI commands
    to solve this problem?
    Best thanks for your help!
    Oliver Friedrich

    Maybe the next time, I'll think about programming platform-independent.
    I thought of your solution, but I've discarded it after considering a few
    more constraints in my application.
    1. I don't want the child window to be movable.
    2. The child has neither menubar, nor frames or resizing or close buttons, I
    want it not to be recognizable as a separate window.
    3. I want to have the parent still capable of getting the focus.
    So, there are quite some problems with modal windows. And further more, my
    product requirement specifications tells me to develop for Win98, NT and so
    on, so what ?
    Anyway, thanks a lot for your help, I hope I can help you one of these days.
    Best regards
    Oliver
    "Labviewguru" schrieb im Newsbeitrag
    news:50650000000500000
    [email protected]..
    > Oliver,
    >
    > My recommendation is to change your methodology. Get away from MS
    > native functions. This will solve your problems, and make your
    > program platform independent.
    >
    > As an alternative, try calling the front panel either as visible using
    > the server, or directly. Then you can set it to frontmost or dialog,
    > as necessary, and even control it's location. This should (though I
    > haven't researched it much) solve your problems. This also puts you
    > back in the driver's seat instead of Microsoft. This is a good
    > discipline to have, if you ever decide (or have it decided for you) to
    > program outside of Microsoft.

  • Photoshop elements 12 editor doesn't open, organizer is fine. I uninstalled the program and re-installed it (restarted the computer each time)...didn't solve the problem. using pc, windows 8.1

    photoshop elements 12 editor doesn't open, organizer is fine. I uninstalled the program and re-installed it (restarted the computer each time)...didn't solve the problem. using pc, windows 8.1
    can someone help me with this issue?

    Two suggestions:  the first one is a workaround. You just have to drill down your program file tree to Adobe Photoshop Elements Organizer and find the .exe file - the one specifically for Organizer, not Elements.  Make a shortcut to that file on your desktop and it will open Organizer. The second suggestion resolved the problem altogether for me. I actually called Dell and after working with several different techs over several different days, I talked to a tech in premium support who was excellent. I discovered from them that it is actually a problem with the windows system files. I have 8.1.  I went through a "refresh" on my computer which rebuilt all the files. Then reinstalled Adobe as well as my other programs again and Photoshop Elements Organizer works from the standard desktop shortcut.

  • JFrames issues repainting dialog windows

    I have an application with a JFrame as the main window. In this window are several components (buttons and a table). Clicking on the buttons opens various dialogs one of the buttons opens another JFrame (was/is a separate application). Everything works fine until this second JFrame is closed. After it is closed all the other dialog windows that now open are "unpainted" until you mouse over each component.
    What am I doing wrong?
    -Tad

    Well originally I was having problems with frame 1 repainting after closing frame2. I fixed that by passing a reference of frame one to frame 2 and when frame 2 closes I update(g) on frame 1 and that fixed the problem. But I'm not adding any of the components to other frames. I don't understand how closing the frame could cause problems repainting dialogs in the other frame especially ones that are called as the static JOptionPane.showMessageDialog(....). I mean everytime you call that shouldn't it be creating an entirely new "window"? why would it paint ok the first time? but not after opening closing another frame?

  • A lot of problems after installing Windows XP using Boot Camp on a Mac Book

    I have been having a lot of problems after installing Windows XP Home Edition (2002).
    For one, after installing Windows using Boot Camp with Mac OS X 10.5.1, I opened Windows on my Mac Book, inserted the Mac OS X Disk 1 as in the instructions and got the message: +"This package requires a newer version of the Windows installer. Do you want to update the version of the Windows Installer on your system?"+ When I clicked Yes (I had NO idea what it meant at the time), I got the message: "The required resource 'UPDATE' is missing" and the Installer quit.
    How do I fix this problem?
    Another problem I have is that there is no sound on the Windows XP, yet it works perfectly on Mac OS X. Is there any way to fix this problem?
    A third problem I have is that I can't wirelessly connect to the internet using Window XP, yet I can on Mac OS X. I have no idea on how to fix this, and it's really messing with me. D:<
    D: There are way too many problems, and I have a feeling there will be a lot more later on. Help....
    ~Twilight

    ---I'm moving this topic to the Boot Camp forums.
    -Twilight

  • I am trying to install iTunes on my PC, but I get this error: "There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor." Help!

    I am trying to install iTunes on my PC (using Windows 8.1), but I get this error: "There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor." The iTunes file (64-bit) I am trying to install, is named "iTunes64Setup.exe". What seems to be the problem? Help!

    Hey madnest,
    Thanks for the question. After reviewing your post, it sounds like you are having difficulty installing iTunes in Windows. I would recommend that you read this article, it may be able to help you resolve or isolate the issue.
    Issues installing iTunes or QuickTime for Windows
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • I keep getting the following error message when I try to update my itunes, "There is a problem with this windows installer package. Aprogram run as part of the set up did not finish as expected.  Contact your support personnel or package vendor."

    I keep getting the following error message when I try to update my itunes, "There is a problem with this windows installer package. Aprogram run as part of the set up did not finish as expected.  Contact your support personnel or package vendor."

    Yes, I had found a similar solution also.  I'm running XP Pro, SP3.  I went Control Panels/ Add-Remove programmes/apple software update/ change/ repair.  Then run the 10.5 exe.
    While the programme updated from version 8 of iTunes, my new iTunes is now a mess.  Not all of my music was in the same folder previously but it all showed up on iTunes.  Now many albums have been left out, some have only a few tracks and some have two copies of some tracks as well as having other tracks missing.  I haven't begun to work on that.

  • I get the errer message "There is a problem with this windows installer package. A program required for this install to complete could not be run."

    I have Wondows Vista... I tried to upgrade to Itunes 10.5, and received an error orginially stating that I was trying to install a version older than the one I had.  I uninstalled all of itunes, and now I'm getting the error  message "there is a problem with this windows installer package.  Aprogram required for this install to complete could not be run.
    Help!  I have an IPhone, and I would like to get my Itunes upgraded so I can download the new Iphone software...
    Thanks!

    I have been in touch with Apple support in reference to my problem. We went through every solution available, and found no fix. The tech then suggested I contact Microsoft concerning this issue. I thought that suggestion was just to get me pointed somewhere but Apple. Boy was I wrong!! I contacted Microsoft, and was directed to a free download called Microsoft Fix. This program fixed something in the regisitor, and wala everything was fixed!! I now have I-Cloud and I-Tunes loaded and working well. So, if you can't install Apple Software and are running Window 7 you might give Microsoft Fix a try, it fixed my problem.....

  • I am trying to upload itunes 10.5, but get a message "There is a problem with this Window Installer Pkg. A program required for this install to complete could not be run.  Contact your support personnel or package vendor".  What is it I need to do?

    I am trying to install itunes 10.5, but during the download I get the following message, "There is a problem with this Window Installer Package.  A program required for this install to complete could not be run.  Contact your support personanal or package vendor."  If this is my personal computer and was able to upgrade to the previous version (pre 10.5), why not now?  What is my "package vendor"? And what is it I need to do to fix this?  The message is unclear.  Unfortunately, I deleted my itunes program, thinking that in doing so, 10.5 would finally load.  Now I have no itunes on my computer and unable to sync my iphone.  Help!
    Thanks - Rick

    Hi Rick,
    by "repair" I mean I went to the control panel, option - programs and features, and in the list of all my installed programs I selected "Apple Software Update". On top of the screen you find the options Uinstall, Change and Repair. I clicked the repair button and that did the trick. After the repair I could uninstall the program. I also uninstalled iTunes, Apple Application Support, Apple Mobile Device Support en Bonjour, thus all Apple programs. Then I installed iTunes 10.5 again and everything went fine.
    Success,
    Peter

  • I purchased an in-app component but it has not downloaded and I cannot seem to contact the seller. I've tried to report a problem but no window opens in which to report the problem. Any ideas?

    I purchased in in-app component for an email program but it has not shown up in the app on my ipad. I tried to report a problem, but no window opens in which to explain my situation. How do I get a message to the seller or to itunes? I am reluctant to re-purchase the component.

    Can you download large files from other places apart from the App store, wondering if it is the App store or your internet connection.
    If it just the app store check this url http://www.apple.com/support/mac/app-store/contact/

  • HT1926 when trying to setup itunes on my pc i get the following message: there is a problem with this Windows installer package. A program required for this install to complete could not be run. How could I solve this problem?

    when trying to setup itunes on my pc i get the following message: there is a problem with this Windows installer package. A program required for this install to complete could not be run. How could I solve this problem?

    Repair your Apple software update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START/CONTROL PANEL/Programs n Features/highlight ASU and click REPAIR,

  • ITunes 10.5 Upgrade fails to Install. The Error Message is: "There is a Problem with this Windows Installer Package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor."

    When Upgrading on my laptop from iTunes 10.2.11 to 10.5.0 the message I get is: "There is a problem with this Windows Installer Package.  Aprogram run as part of the setup did not finish as expected. Contact your support personnel or pacakge vendor.

    After reading all these posts, one by one did not resolve my problem until I got the very end.  Regardless of what step would resolve your problem, these are the steps I would recomment to everyone for a what seems to be a safe and fool-proof upgrade to iTunes 10.5.
    1. Stand alone upgrade to the latest Quicktime version
    2. Go to control panel and "change" then select repair to the following applications in the order specified by the post on Oct 27. (Notice I skipped Quicktime because it had been upgrade manually,and Bonjour did not have a "repair" option)
    iTunes; Apple Software Update: Mobile Device Support; Apple Applications Support
    Some of these applications may not appear if they do not apply to your configuration (no iPhone, or no iPad, or other apple devices).
    Once all updated, I did not need to restart nor launch any applications, I simply went straight into the 10.5 upgrade, and where it normally got stuck, this time the installation continued for a while longer until it completed successfully.
    Great work everyone who contributed!  Thank you very much!

  • How to re-install iTunes after receiving "There is a problem with this Windows Installer package ..." message?

    Hi,
    This is how it all started. When the new update for iTunes 11 came out, I tried to update it. After I had updated it I found nothing had changed. So i tried rebooting my computer and everything and found that still nothing had changed. So I tried uninstalling it. After that I tried to re-install it, but it came up with the
    "There is a problem with this Windows Installer package ..." message. So I looked around the internet and found a website that told me to uninstall all Apple products. So i did that. When i tried to uninstall Apple Software Update, it came up with the 'problem with windows' message again. So I used Revo to uninstall it. So I rebooted and tried to install it again. It installed Bonjour and all of the other programs but stopped halfway and gave me the 'proplem with windows' message again. I've looked around and most of the solutions have been to try and repair Apple Software Update, but the problem is, I've already deleted it. So can someone PLEASSEEEE help me fix this problem! (Sorry for droning on)

    http://support.microsoft.com/mats/Program_Install_and_Uninstall  try this an see if it fixes it.

Maybe you are looking for

  • Home sharing Primary Library on IPAD

    Hi Everyone I have home sharing setup for music on my IPAD. However the home sharing library is the secondary library on the IPAD. Everytime I open the iPad I have to go to shared>and click the correct library. I have deleted all the music from the i

  • Nano won't resume tune when turned on again - jumps to next one.

    I was under the impression that, if I turned my nano off in the middle of a tune, it would resume playing that tune when switched on again and play is pressed. Mine waits for about 2 seconds and then jumps to the start of the next tune, every time. I

  • How to display the open file dialogue in SBO 2007

    Hi I have my own form on screen with a edit text box which will contain the path and name of a file entered by the user Is there any way I can display the windows open file dialogue so the user can search for a file ? Many thanks Regards Andy

  • Variable in Planning KM

    Hi I am trying to pass a variable in the Planning KM for Log files and Error files. This is what I have done.. Created a variable in the Project FILEPATH which has alphanumeric value C:\ODI_META In Planning KM at the place of log file path I gave #FI

  • Why does my guitar make crackling noises when it plays through logic pro/garageband?

    When my guitar plays directly through the interface and montors, it sounds perfectly fine. But whenever I want to add effects through a musical application  such as garageband or logic pro x, I get this weird, very loud crackling/bubbly sound. Can an