473,543 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inventory project

1 New Member
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
Apr 21 '10 #1
1 2139
jkmyoung
2,057 Recognized Expert Top Contributor
Have you included the UsedDVD class in your build path? Or have you not written the class yet?
Apr 21 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3744
by: smonczka | last post by:
I am trying to locate an inventory template. I have looked at the one that comes with Access but what I need is a little more complicated. We ship boxes of software and the inventory consists not of the boxes but of the elements that make up the box, such as a box, a CD and a manual. The some elements may included in other products. So I...
13
3961
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate button "Unexpected Error":3251 operation is not supported for this type of object.The demo cd has two databases, one is called inventory and the other...
3
3218
by: Henrik | last post by:
Hi all, I'm a .net developer working with developing automation equipment for the sawmill industry. The main focus of our product line is mechanical and measurement equipment but our clients start asking us for an inventory system to keep track of their produced volume. I am new to this area (all I've done so far is store production data...
109
25708
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the assignments... 4. CheckPoint: Inventory Program Part 1 • Resource: Java: How to Program • Due Date: Day 5 forum • Choose a product that lends...
0
7097
by: south622 | last post by:
I'm taking a beginning Java course and I'm stuck in week eight of a nine week course. If anyone could help me I would greatly appreciate it. This assignment was due yesterday and each day I go past the due date 10% of the grade is taken off. I think I'm coming down with the flu and my brain is just not processing this assignment. Here is the...
9
7597
by: xxplod | last post by:
I am suppose to modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In...
3
6972
by: cblank | last post by:
I need some help if someone could help me. I know everyone is asking for help in java. But for some reason I'm the same as everyone else when it comes to programming in java. I have an inventory program that I have built so far with no problem. But I cannot figure out how to turn it into a GUI application. This is what I'm trying to get it to do....
2
2505
by: pinkf24 | last post by:
I cannot figure out how to add the following: Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an...
1
2651
by: jcato77 | last post by:
I need help with a class project I'm working on, Below is my assignment and the code I have currently created. Assignment: Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). In the subclass,...
3
4464
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional...
0
7411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7693
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4898
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3394
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3394
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1824
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
643
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.