Rename class not working on one function but works fine on the other
<p>My other function creates a temp_products.txt file and renames it to products.txt</p>

<p>the other creates temp_sold_products.txt and renames it to sold_products.txt. could this be because of the name of the files?</p>

<p>SoldProducts File:</p>

<p>package com.simple.inventory.views;</p>

<pre><code>import com.simple.inventory.constants.Constant;
import com.simple.inventory.models.Product;
import com.simple.inventory.models.SoldProduct;
import com.simple.inventory.utility.Utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;


public class SellProdDialog extends javax.swing.JDialog {

/**
 * Creates new form SellProdDialog
 */
public SellProdDialog(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();

    this.soldProducts = new ArrayList&lt;&gt;();
    this.tableModel = (DefaultTableModel) this.jTblSold.getModel();

    this.apFrm = (AddProductFrm) parent;
    this.jtfName.setText(apFrm.jtfName.getText());
    this.jtfPrice.setText(apFrm.jtfPrice.getText());

    this.jtfQuantity.requestFocus();

    this.initWriter(Constant.TEMP_SOLD_PRODUCTS_FILE);
    this.readProducts();
}

/**
 * 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.
 */
@SuppressWarnings("unchecked")
// &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;//GEN-BEGIN:initComponents
private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jtfName = new javax.swing.JTextField();
    jtfPrice = new javax.swing.JTextField();
    jtfQuantity = new javax.swing.JTextField();
    jLabel5 = new javax.swing.JLabel();
    jlblTotal = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jtfAmount = new javax.swing.JTextField();
    jLabel7 = new javax.swing.JLabel();
    jlblChange = new javax.swing.JLabel();
    jbtnSellProduct = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTblSold = new javax.swing.JTable();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Sell Product");
    setResizable(false);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Product Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Andale Mono", 1, 14))); // NOI18N

    jLabel1.setText("Product Name:");

    jLabel3.setText("Product Price:");

    jLabel4.setText("Quantity:");

    jtfName.setEditable(false);

    jtfPrice.setEditable(false);

    jtfQuantity.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            jtfQuantityCaretUpdate(evt);
        }
    });
    jtfQuantity.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusGained(java.awt.event.FocusEvent evt) {
            jtfQuantityFocusGained(evt);
        }
    });

    jLabel5.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    jLabel5.setText("TOTAL PRICE:");

    jlblTotal.setFont(new java.awt.Font("Ubuntu", 0, 15)); // NOI18N
    jlblTotal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jlblTotal.setText("Php 0.00");
    jlblTotal.setBorder(javax.swing.BorderFactory.createEtchedBorder());

    jLabel6.setText("Amount Rendered:");

    jtfAmount.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            jtfAmountCaretUpdate(evt);
        }
    });
    jtfAmount.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusGained(java.awt.event.FocusEvent evt) {
            jtfAmountFocusGained(evt);
        }
    });

    jLabel7.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
    jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    jLabel7.setText("CHANGE:");

    jlblChange.setFont(new java.awt.Font("Ubuntu", 0, 15)); // NOI18N
    jlblChange.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jlblChange.setText("Php 0.00");
    jlblChange.setBorder(javax.swing.BorderFactory.createEtchedBorder());

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel1Layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGap(9, 9, 9)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jtfQuantity, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jtfPrice, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jtfName)))
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jlblChange, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jtfAmount)
                        .addComponent(jlblTotal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addContainerGap())
    );
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel1Layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel1)
                .addComponent(jtfName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel3)
                .addComponent(jtfPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel4)
                .addComponent(jtfQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel5)
                .addComponent(jlblTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jtfAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLabel6))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jlblChange, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jLabel7))
            .addContainerGap(21, Short.MAX_VALUE))
    );

    jbtnSellProduct.setText("Sell Product");
    jbtnSellProduct.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnSellProduct.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbtnSellProductActionPerformed(evt);
        }
    });

    jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Sold Products"));

    jTblSold.setModel(new javax.swing.table.DefaultTableModel(
        new Object [][] {

        },
        new String [] {
            "Product Name", "Quantity", "Product Price", "Total Price", "Amount Paid", "Change"
        }
    ) {
        Class[] types = new Class [] {
            java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class
        };
        boolean[] canEdit = new boolean [] {
            false, false, false, false, false, false
        };

        public Class getColumnClass(int columnIndex) {
            return types [columnIndex];
        }

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit [columnIndex];
        }
    });
    jScrollPane1.setViewportView(jTblSold);

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel2Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 687, Short.MAX_VALUE)
            .addContainerGap())
    );
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel2Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)
            .addContainerGap())
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jbtnSellProduct, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jbtnSellProduct, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addContainerGap())
    );

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width-757)/2, (screenSize.height-532)/2, 757, 532);
}// &lt;/editor-fold&gt;//GEN-END:initComponents

private void jbtnSellProductActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSellProductActionPerformed
    /**
     * HELLO :))
     * Just follow thru the code. You will understand it already as the codes
     * are self-explanatory.
     * 
     * String.format("Php %,.2f", price) ==&gt; just formats an ordinary string
     * to this format Php {price_here.00} (e.g. Php 1,001.50)
     * 
     * Other functionalities? Come, see it yourself.
     */
    try {
        this.jtfQuantity.requestFocus();    // for caret update purposes
        this.jtfAmount.requestFocus();      // for caret update purposes

        String sQuantity = jtfQuantity.getText();
        String sAmount = jtfAmount.getText();

        if(sQuantity.length() == 0) {
            JOptionPane.showMessageDialog(this, "Kindly enter a quantity before selling.", "Inventory v.1.0", JOptionPane.INFORMATION_MESSAGE);
            this.jtfQuantity.requestFocus();
            return;
        }

        if(sAmount.length() == 0) {
            JOptionPane.showMessageDialog(this, "Kindly enter amount.", "Inventory v.1.0", JOptionPane.INFORMATION_MESSAGE);
            this.jtfAmount.requestFocus();
            return;
        }

        String prodName = this.jtfName.getText();
        int quantity    = Integer.parseInt(sQuantity);
        double amount   = Double.parseDouble(sAmount);
        double price    = Double.parseDouble(jtfPrice.getText());
        double total    = quantity * price;
        double change   = amount - total;
        int stocks      = Integer.parseInt(apFrm.jtfStocks.getText());
        stocks          -= quantity;

        if(stocks &gt;= 0) {
            if(change &gt;= 0) {
                this.apFrm.jtfStocks.setText(stocks + "");
                this.apFrm.isEdit = false;
                this.apFrm.editProduct();

                SoldProduct sp = new SoldProduct(
                        prodName, 
                        sQuantity, 
                        String.format("Php %,.2f", price), 
                        String.format("Php %,.2f", total), 
                        String.format("Php %,.2f", amount), 
                        String.format("Php %,.2f", change));

                this.writeProduct(sp);

                JOptionPane.showMessageDialog(this, "Product '" + prodName + "' has been sold successfully.", "Inventory v.1.0", JOptionPane.INFORMATION_MESSAGE);
                this.setVisible(false);
            } else {
                JOptionPane.showMessageDialog(this, "You lack " + String.format("Php %,.2f", Math.abs(change)) + "!",
                    "Ooopss!", JOptionPane.ERROR_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(this, "Product '" + prodName + "' is out of stock.\n"
                    + "We cannot provide you " + String.format("%,d", Math.abs(stocks)) + " item(s) more.", 
                    "Inventory v.1.0", JOptionPane.ERROR_MESSAGE);
        }
    } catch(Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(this, "You have inputted an invalid data.", "Inventory v.1.0", JOptionPane.INFORMATION_MESSAGE);
        this.jtfQuantity.requestFocus();
    }
}//GEN-LAST:event_jbtnSellProductActionPerformed

private void jtfQuantityCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jtfQuantityCaretUpdate
    try {
        int quantity  = Integer.parseInt(jtfQuantity.getText());
        double price  = Double.parseDouble(jtfPrice.getText());
        double total  = price * quantity;
        String sTotal = String.format("Php %,.2f", total);

        this.jlblTotal.setText(sTotal);
    } catch(Exception e) {
        // wa lng.. :D
        this.jlblTotal.setText("Php 0.00");
    }
}//GEN-LAST:event_jtfQuantityCaretUpdate

private void jtfQuantityFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtfQuantityFocusGained
    jtfQuantity.selectAll();
}//GEN-LAST:event_jtfQuantityFocusGained

private void jtfAmountFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jtfAmountFocusGained
    this.jtfAmount.selectAll();
}//GEN-LAST:event_jtfAmountFocusGained

private void jtfAmountCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jtfAmountCaretUpdate
    try {
        int quantity   = Integer.parseInt(jtfQuantity.getText());
        double price   = Double.parseDouble(jtfPrice.getText());
        double total   = price * quantity;
        double amount  = Double.parseDouble(jtfAmount.getText());
        double change  = amount - total;
        String sChange = String.format("Php %,.2f", change);

        this.jlblChange.setText(sChange);
    } catch(Exception e) {
        // wa lng.. :D
        this.jlblChange.setText("Php 0.00");
    }
}//GEN-LAST:event_jtfAmountCaretUpdate

private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
    File f = new File(Constant.TEMP_SOLD_PRODUCTS_FILE);
    if(f.exists()) {
        if(!f.renameTo(new File(Constant.SOLD_PRODUCTS_FILE))) {
            Utils.renameFile(Constant.TEMP_SOLD_PRODUCTS_FILE, Constant.SOLD_PRODUCTS_FILE);
        }

        if(f.delete()) {
            System.out.println("OLD FILE DELETED");
        } else {
            System.out.println("OLD FILE NOT DELETED -- WHY?");
        }
    }
}//GEN-LAST:event_formWindowClosing

private void initWriter(String filename) {
    File f = null;
    try {
        f = new File(filename);

        if(!f.exists()) {
            f.createNewFile();
        }

        this.pWriter = new PrintWriter(new FileWriter(f), true);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

private void readProducts() {
    File f = new File(Constant.SOLD_PRODUCTS_FILE);
    BufferedReader br = null;
    String line = "";

    try {
        br = new BufferedReader(new FileReader(f));
        while((line = br.readLine()) != null) {
            this.tokenizeSoldProduct(line);
        }
        br.close();
    } catch(FileNotFoundException e) {
        // wa lng.. :D
    } catch(IOException e) {
        e.printStackTrace();
    } finally {
        if(br != null) {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

private void tokenizeSoldProduct(String product) {
    try {
        StringTokenizer st = new StringTokenizer(product, Constant.DELIM_TAB);
        SoldProduct p = new SoldProduct(
                st.nextToken().trim(),
                st.nextToken().trim(),
                st.nextToken().trim(),
                st.nextToken().trim(),
                st.nextToken().trim(),
                st.nextToken().trim());

        this.writeProduct(p);
    } catch(Exception e) {
        e.printStackTrace();
    }
}

private void writeProduct(SoldProduct p) {
    try {
        pWriter.println(p.toString());

        this.soldProducts.add(p);

        this.insertProductToTable(p);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

private void insertProductToTable(SoldProduct p) {
    tableModel.insertRow(jTblSold.getRowCount(), new Object[] {
            p.getName(),
            p.getQuantity(),
            p.getPrice(),
            p.getTotalPrice(),
            p.getAmountPaid(),
            p.getChange()
        });
}

/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt;
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(SellProdDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(SellProdDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(SellProdDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(SellProdDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //&lt;/editor-fold&gt;

    /* Create and display the dialog */
    java.awt.EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            SellProdDialog dialog = new SellProdDialog(new javax.swing.JFrame(), true);
            dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                @Override
                public void windowClosing(java.awt.event.WindowEvent e) {
                    System.exit(0);
                }
            });
            dialog.setVisible(true);
        }
    });
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTblSold;
private javax.swing.JButton jbtnSellProduct;
private javax.swing.JLabel jlblChange;
private javax.swing.JLabel jlblTotal;
private javax.swing.JTextField jtfAmount;
private javax.swing.JTextField jtfName;
private javax.swing.JTextField jtfPrice;
private javax.swing.JTextField jtfQuantity;
// End of variables declaration//GEN-END:variables

private AddProductFrm apFrm;
private ArrayList&lt;SoldProduct&gt; soldProducts;

private PrintWriter pWriter;

private DefaultTableModel tableModel;
</code></pre>

<p>}</p>

<p>The problem here is that the rename function that should rename temp_sold_products.txt to sold_products.txt is not working. the changes are saved to temp_sold_products.txt as expected but the renaming part is not working, even the prints are not displaying could it be because it is not called at all, but then why is it working for the add product part when the have similar codes. </p>

<p>I dont get why it is not working, both have the same codes in them. any help would be appreciated. thank you</p>
