I've been trying to compile this program:
// Display The CDs.
import java.text.*;
import java.util.*;
import java.awt.*;
import java.awt.FlowLa yout;
import java.awt.event. ActionListener;
import java.awt.event. ActionEvent;
import javax.swing.JFr ame;
import javax.swing.JBu tton;
import javax.swing.JTe xtField;
import javax.swing.Ico n;
import javax.swing.Ima geIcon;
import javax.swing.JOp tionPane;
import javax.swing.*;
public class ButtonFrame extends JFrame
{
private JButton nextJButton; // button with just text
private JButton prevJButton; // button with icons
private JButton lastJButton; // button with just text
private JButton firstJButton; // button with icons
private JButton deleteJButton; // button with icons
private JButton addJButton; // button with icons
private JLabel logoLabel;
private JTextField space1;
private JTextField space2;
private JTextField lblActor; // text field with set size
private JTextField txtActor; // text field constructed with text
private JTextField lblItemNum; // text field with set size
private JTextField txtItemNum; // text field constructed with text
private JTextField lblTitle; // text field with set size
private JTextField txtTitle; // text field constructed with text
private JTextField lblQuantity; // text field with set size
private JTextField txtQuantity; // text field constructed with text
private JTextField lblUnitPrice; // text field with set size
private JTextField txtUnitPrice; // text field constructed with text
private JTextField lblRestockFee; // text field with set size
private JTextField txtRestockFee; // text field constructed with text
private JTextField lblItemValue; // text field with set size
private JTextField txtItemValue; // text field constructed with text
private JTextField lblInventoryVal ue; // text field with set size
private JTextField txtInventoryVal ue; // text field constructed with text
// Just keeping an a class variable to keep count of where I am in the array
// keeping a class variable of the myPlayer array that I passed
UsedDVD[] arrayDVDs;
private int currentArrayCou nter;
private int arrayCount;
private String invTotal;
// public Image i;
// i = getImage(getDoc umentBase(), "logo.gif") ;
// ButtonFrame adds JButtons to JFrame
public ButtonFrame(Use dDVD[] myDVDs, int totalArrayCount , String stringInventory Total)
{
super( "UsedDVD Inventory" );
arrayDVDs = myDVDs;
invTotal=string InventoryTotal;
// drawImage(i,0,0 );
// I am setting the local passed variable totalArrayCount
// to the class variable arrayCounter so I can see it in the setTextfields method
arrayCount = totalArrayCount ;
currentArrayCou nter = 0;
// Sertting the current array position to 0
setLayout( new FlowLayout() ); // set frame layout
// Load the next and previous icons
Icon logo = new ImageIcon( getClass().getR esource( "logo.gif" ) );
Icon iconAdd = new ImageIcon( getClass().getR esource( "add.gif" ) );
Icon iconNext = new ImageIcon( getClass().getR esource( "forward.gi f" ) );
Icon iconPrev = new ImageIcon( getClass().getR esource( "back.gif" ) );
Icon iconLast = new ImageIcon( getClass().getR esource( "last.gif" ) );
Icon iconFirst = new ImageIcon( getClass().getR esource( "first.gif" ) );
Icon iconDelete = new ImageIcon( getClass().getR esource( "Delete.gif " ) );
logoLabel = new JLabel("",logo, SwingConstants. LEFT);
add(logoLabel);
// construct Label Fields with default text and 25 columns
space1 = new JTextField( "", 20 );
space1.setEdita ble( false ); // disable editing
add( space1 );
space2 = new JTextField( "", 20 );
space2.setEdita ble( false ); // disable editing
add( space2 );
lblItemNum = new JTextField( "Item Number", 25 );
lblItemNum.setE ditable( false ); // disable editing
add( lblItemNum );
txtItemNum = new JTextField("", 25 );
add( txtItemNum ); // add txtActor to JFrame
lblActor = new JTextField( "Actor ", 25 );
lblActor.setEdi table( false ); // disable editing
add( lblActor );
txtActor = new JTextField("", 25 );
add( txtActor ); // add txtActor to JFrame
lblTitle = new JTextField( "Title", 25 );
lblTitle.setEdi table( false ); // disable editing
add( lblTitle );
txtTitle = new JTextField("", 25 );
add( txtTitle ); // add txtActor to JFrame
lblQuantity = new JTextField( "Quantity", 25 );
lblQuantity.set Editable( false ); // disable editing
add( lblQuantity );
txtQuantity = new JTextField("", 25 );
add( txtQuantity ); // add txtActor to JFrame
lblUnitPrice = new JTextField( "Unit Price", 25 );
lblUnitPrice.se tEditable( false ); // disable editing
add( lblUnitPrice );
txtUnitPrice = new JTextField("", 25 );
add( txtUnitPrice ); // add txtUnitPrice to JFrame
lblRestockFee = new JTextField( "Restocking Fee", 25 );
lblRestockFee.s etEditable( false ); // disable editing
add( lblRestockFee );
txtRestockFee = new JTextField("", 25 );
add( txtRestockFee ); // add txtActor to JFrame
lblItemValue = new JTextField( "Total Item Value", 25 );
lblItemValue.se tEditable( false ); // disable editing
add( lblItemValue );
txtItemValue = new JTextField("", 25 );
add( txtItemValue ); // add txtActor to JFrame
lblInventoryVal ue = new JTextField( "Total Inventory Value", 25 );
lblInventoryVal ue.setEditable( false ); // disable editing
add( lblInventoryVal ue );
txtInventoryVal ue = new JTextField(invT otal, 25 );
add( txtInventoryVal ue ); // add txtActor to JFrame
// construct textfield with default text
// Create the buttons
nextJButton = new JButton( "Next", iconNext ); // button with Next
prevJButton =new JButton( "Prev" , iconPrev ); // button with Prev
lastJButton = new JButton( "Last", iconLast ); // button with Last
firstJButton =new JButton( "First" , iconFirst ); // button with First
deleteJButton = new JButton("Delete ",iconDelet e);
addJButton = new JButton ( "Add",iconA dd);
add( addJButton );
add( firstJButton ); // add plainJButton to JFrame
add(prevJButton );
add( nextJButton ); // add plainJButton to JFrame
add(lastJButton );
add(deleteJButt on);
// create new ButtonHandler for button event handling
ButtonHandler handler = new ButtonHandler() ;
addJButton.addA ctionListener ( handler );
firstJButton.ad dActionListener ( handler );
prevJButton.add ActionListener( handler );
nextJButton.add ActionListener( handler );
lastJButton.add ActionListener( handler );
deleteJButton.a ddActionListene r( handler );
// Now I am going to call SetTextFields to set the text fields
setTextFields() ;
} // end ButtonFrame constructor
These are my error codes what am I doing wrong?
// inner class for button event handling
private class ButtonHandler implements ActionListener
{
// handle button event
public void actionPerformed ( ActionEvent event )
{
System.out.prin tln("In Action Command - Current Event is " + event.getAction Command());
// See which button was pressed
if (event.getActio nCommand()== "Next"){
currentArrayCou nter++;
}
else if (event.getActio nCommand()== "Prev"){
currentArrayCou nter--;
}
else if (event.getActio nCommand()== "Last"){
currentArrayCou nter= arrayCount-1;
}
else if (event.getActio nCommand()== "First"){
currentArrayCou nter = 0;
}
else if (event.getActio nCommand()== "Add"){
arrayDVDs[currentArrayCou nter=1].addToQuantity( );
}
else if (event.getActio nCommand()== "Delete"){
arrayDVDs[currentArrayCou nter].removeOneFromQ uantity();
System.out.prin tln("Deleting") ;
}
setTextFields() ;
} // end method actionPerformed
} // end private inner class ButtonHandler
private void setTextFields ()
{
// This is to ensure that you are not at the end of the array
if (currentArrayCo unter == arrayCount)
{
currentArrayCou nter = 0;
}
// This is set to prevent from going past the first if so I am setting it to the last
if (currentArrayCo unter < 0)
{
currentArrayCou nter = arrayCount-1;
}
// System.out.prin tln(currentArra yCounter); // Debug statement
NumberFormat n = NumberFormat.ge tCurrencyInstan ce(Locale.US); //Provides Locale appropriate currency format
txtActor.setTex t(arrayDVDs[currentArrayCou nter].getactor());
txtItemNum.setT ext(arrayDVDs[currentArrayCou nter].getitemnumber( ));
txtTitle.setTex t(arrayDVDs[currentArrayCou nter].gettitle());
txtQuantity.set Text(Double.toS tring(arrayDVDs[currentArrayCou nter].getquantity()) );
txtUnitPrice.se tText(Double.to String(arrayDVD s[currentArrayCou nter].getunitprice() ));
String stringRestockFe e = n.format(arrayD VDs[currentArrayCou nter].CalculateResto ckFee());
txtRestockFee.s etText(stringRe stockFee);
txtItemValue.se tText(n.format( arrayDVDs[currentArrayCou nter].calculateDVDVa lue()));
}
} // end class ButtonFrame
E:\java\ButtonF rame.java:51: cannot find symbol
symbol : class UsedDVD
location: class ButtonFrame
UsedDVD[] arrayDVDs;
^
E:\java\ButtonF rame.java:61: cannot find symbol
symbol : class UsedDVD
location: class ButtonFrame
public ButtonFrame(Use dDVD[] myDVDs, int totalArrayCount , String stringInventory Total)
^
2 errors
Tool completed with exit code 1