Here are the errors I am getting, but I can't figure it out. Please help:
GUI.java: 10: illegal start of expression
public GUI(MovieCollection i) {
^
GUI.java: 110: illegal start of expression
private javax.swing.JButton extButton;
^
GUI.java:111: illegal start of expression
private javax.swing.JTextArea text Area;
Here is my program:
//GUI.java
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;
initComponents();
repaint();
}
/** 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();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
nextButton.setText("Next");
nextButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nextButtonActionPerformed(evt);
}
});
textArea.setColumns(20);
textArea.setEditable(false);
textArea.setRows(5);
jScrollPane1.setViewportView(textArea);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(nextButton)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
.add(nextButton))
.addContainerGap())
);
pack();
}// </editor-fold>
private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {
inventory.advance();
repaint();
}
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.setText("");
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
}
}