Here are the errors I am getting, but I can't figure it out. Please help: 10: illegal start of expression

public GUI(MovieCollection i) {
   ^ 110: illegal start of expression
   private javax.swing.JButton extButton;
   ^ illegal start of expression
   private javax.swing.JTextArea text Area;

Here is my program:

package product;
import java.text.NumberFormat;

public class GUI extends javax.swing.JFrame{
    MovieCollection inventory;

    /** Creates new form GUI */
    public GUI(MovieCollection i) {
        inventory = i;

    /** 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() {

        nextButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        textArea = new javax.swing.JTextArea();


        nextButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {


        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)

    }// </editor-fold>

    private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           

    public void repaint() {

    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance();

    // fetch the current Movie object to show on screen
    Movie theMovie = inventory.getCurrent();

    // get all the properties from that movie object
    String title = theMovie.getTitle();
    int number = theMovie.getNumber();
    int stock = theMovie.getQuantity();
    double price = theMovie.getPrice();
    int year = theMovie.getYear();
    double value = theMovie.getItemValue();
    double restockingFee = theMovie.getRestockingFee();

        textArea.append("DVD # :    "+ number + "\n");
        textArea.append("DVD Title :    "+ title + "\n");
        textArea.append("DVD Year : "+ year + "\n");
        textArea.append("# in Stock :   "+ stock + "\n");
        textArea.append("Unit Price :   "+ moneyFormat.format(price) + "\n");
        textArea.append("Inventory value:   "+ moneyFormat.format(value) + "\n");
        textArea.append("Restocking fee :   "+ moneyFormat.format(restockingFee) + "\n");

     * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                // new GUI().setVisible(true);

    // Variables declaration - do not modify
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton nextButton;
    private javax.swing.JTextArea textArea;
    // End of variables declaration


Edited 3 Years Ago by Reverend Jim: Fixed formatting

Thanks. When I remove the bracket I end up with 12 errors. If I place a bracket after :

import java.text.NumberFormat;

When I add it here, I still come up with 3 similar errors.

Indent your code so you can see which { match up with which }. Post your code here with code=java tags. Just trying different places at random will not succeed. Keep your Java syntax primer open by your side - for example there's no syntax (that I know of) that allows a { to follow an import statement. Getting more errors when you fix the brackets is not necessaril a bad thing - it may mean that the compiler is now able to get further through its compilation

This article has been dead for over six months. Start a new discussion instead.