•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 456,597 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,423 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 10650 | Replies: 44
![]() |
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I tried to run this code as written
Correction... I tried to compile the code as written
I got a ".\ActionListener.java: class, interface, or enum expected" for every single line of code.
That makes no sense! I have tried to reveiw the tutorials on ActionListener and its implementation but I'm having trouble connecting the dots.
Is there a significant change from Java 1.4 to the 1.5 and beyond. I think I have JDK suite installed on my CPU.
or is there a gap in the program I just missed or is 'assumed' and just not written in.
Correction... I tried to compile the code as written
I got a ".\ActionListener.java: class, interface, or enum expected" for every single line of code.
That makes no sense! I have tried to reveiw the tutorials on ActionListener and its implementation but I'm having trouble connecting the dots.
Is there a significant change from Java 1.4 to the 1.5 and beyond. I think I have JDK suite installed on my CPU.
or is there a gap in the program I just missed or is 'assumed' and just not written in.
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,630
Reputation:
Rep Power: 12
Solved Threads: 311
Yes there lots of differences between this two versions. However you should speed up as there is Java 1.6 aviable over a year already
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
Publilius Syrus
(~100 BC)
LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
•
•
Join Date: Oct 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I am also doing inventoy program 5 but my issue is that i have an double array.
an honestly i can think of a way to get the info to diplay one at a time because of this. i dont know if i would be better of swiching to a singal array or if i can do a if loop some how.
this is what i have so far if someone could point me in the right way that would be great because im not get much help from my teach.
import java.awt.*;
import javax.swing.*;
public class iteminventory7
{
/** Creates a new instance of StoreItemInventory */
public static void main (String[] args)
{
double Game[][] = { { 1550, 100, 230.5, 0 },
{ 1552, 110, 220.5, 0 },
{ 1553, 10, 120.5, 0 },
{ 1554, 200, 20.75, 0 },
{ 1555, 130, 20.35, 0 },
{ 1556, 120, 22.5, 0 },
{ 1557, 100, 50.5, 0 },
{ 1558, 111, 40.5, 0 },
{ 1559, 220, 30.5, 0 },
{ 1560, 133, 20.5, 0 },
{ 1561, 1220, 10.5, 0 } };
iteminventory myGame = new iteminventory( "Items","Out of this World !!!", Game );
myGame.displaymessage();
myGame.outputitems();
}
public static class iteminventory
{
/** Creates a new instance of iteminventory */
private String storeName;
private String itemName;
private double Game[][];
private double Itemvalue;
private int UnitAmount;
private double Restockfee;
public iteminventory(String name, String Sname, double GameArray[][])
{
storeName = Sname;
itemName = name;
Game = GameArray;
}
public String getstoreName()
{
return storeName;
}
//displays main message
public void displaymessage()
{
System.out.printf( "Welcome to our Store : %s!\n", getstoreName());
}
// method returning itemname
public String getitemName()
{
return itemName;
}
// method setting itemname
public void setitemName(String name, int index)
{
itemName = name;
}
//performs the various operations on the item inventory info
public double gettotal(int atcount )
{
double total = 0.0; // initialize total
// sum inventory average
total = (Game[atcount][1]) * (Game[atcount][2]);
return total;
}
//prints out a listing of the item information
public double getRestockfee(int atcount )
{
double total2 = 0.0; // sum inventory average
total2 = (Game[atcount][1]) * (Game[atcount][2] * 0.05);
return total2;
}
//prints out a listing of the item information
public void outputitems()
{
Labels mylabels = new Labels(); // create Labels
mylabels.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
mylabels.setSize(535, 480); // set frame size
mylabels.setVisible( true ); // display frame
}
public class Labels extends JFrame
{
private JLabel itemNameLabel;
private JLabel itemNumberLabel;
private JLabel UnitAmountLabel;
private JLabel ItemvalueLabel;
private JLabel InventoryvalueLabel;
private JLabel RestockingfeeLabel;
private JLabel totalInventoryValueLabel;
private JFrame frame = new JFrame();
private TextArea text = new TextArea();
//frame.getContentPane();add(BorderLayout.WEST, JLabels);
// Labels constructor adds JLabels to JFrame
public Labels()
{
super( "Inventory Program" );
setLayout( new FlowLayout() ); // set frame layout
// JLabel constructor
text.setSize(50,485);
itemNameLabel = new JLabel("Name: ");
itemNameLabel.setToolTipText("Name Label ");
add( itemNameLabel ); // add bookTitleLabel to JFrame
itemNumberLabel = new JLabel("Item Number: ");
itemNumberLabel.setToolTipText("Item Number Label ");
add( itemNumberLabel ); // add itemNumberLabel to JFrame
UnitAmountLabel = new JLabel("UnitAmount: ");
UnitAmountLabel.setToolTipText("UnitAmount Label");
add( UnitAmountLabel ); // add bookUnitsLabel to JFrame
ItemvalueLabel = new JLabel("Item Price: ");
ItemvalueLabel.setToolTipText("Item Price Label");
add( ItemvalueLabel ); // add bookPriceLabel to JFrame
InventoryvalueLabel = new JLabel("Inventory Value: ");
InventoryvalueLabel.setToolTipText("Inventory Value Label");
add ( InventoryvalueLabel ); // add inventoryValueLabel to JFrame
RestockingfeeLabel = new JLabel("Restocking Fee: ");
RestockingfeeLabel.setToolTipText("Restocking Fee Label");
add( RestockingfeeLabel ); // add bookRestockingFeeLabel to JFrame
add(text);
text.setText(getstoreName());
} // end Label constructor
} // end class Labels
}
}
I know how to do a button for a single array button I so lost Im on my 7th file trying to figure out how to do this with a double array. I know im making this a lot harder then it real is but i think my brain stop working somewhere along the 5 file. well tell me what you guys think if its a lose or if i can use so type of loop. i think an if and a else loop would work or if i would just be better off going with a single array
thanks for the help and if it seems like im asking for code im sorry im not the best at wording this type of stuff.
an honestly i can think of a way to get the info to diplay one at a time because of this. i dont know if i would be better of swiching to a singal array or if i can do a if loop some how.
this is what i have so far if someone could point me in the right way that would be great because im not get much help from my teach.
import java.awt.*;
import javax.swing.*;
public class iteminventory7
{
/** Creates a new instance of StoreItemInventory */
public static void main (String[] args)
{
double Game[][] = { { 1550, 100, 230.5, 0 },
{ 1552, 110, 220.5, 0 },
{ 1553, 10, 120.5, 0 },
{ 1554, 200, 20.75, 0 },
{ 1555, 130, 20.35, 0 },
{ 1556, 120, 22.5, 0 },
{ 1557, 100, 50.5, 0 },
{ 1558, 111, 40.5, 0 },
{ 1559, 220, 30.5, 0 },
{ 1560, 133, 20.5, 0 },
{ 1561, 1220, 10.5, 0 } };
iteminventory myGame = new iteminventory( "Items","Out of this World !!!", Game );
myGame.displaymessage();
myGame.outputitems();
}
public static class iteminventory
{
/** Creates a new instance of iteminventory */
private String storeName;
private String itemName;
private double Game[][];
private double Itemvalue;
private int UnitAmount;
private double Restockfee;
public iteminventory(String name, String Sname, double GameArray[][])
{
storeName = Sname;
itemName = name;
Game = GameArray;
}
public String getstoreName()
{
return storeName;
}
//displays main message
public void displaymessage()
{
System.out.printf( "Welcome to our Store : %s!\n", getstoreName());
}
// method returning itemname
public String getitemName()
{
return itemName;
}
// method setting itemname
public void setitemName(String name, int index)
{
itemName = name;
}
//performs the various operations on the item inventory info
public double gettotal(int atcount )
{
double total = 0.0; // initialize total
// sum inventory average
total = (Game[atcount][1]) * (Game[atcount][2]);
return total;
}
//prints out a listing of the item information
public double getRestockfee(int atcount )
{
double total2 = 0.0; // sum inventory average
total2 = (Game[atcount][1]) * (Game[atcount][2] * 0.05);
return total2;
}
//prints out a listing of the item information
public void outputitems()
{
Labels mylabels = new Labels(); // create Labels
mylabels.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
mylabels.setSize(535, 480); // set frame size
mylabels.setVisible( true ); // display frame
}
public class Labels extends JFrame
{
private JLabel itemNameLabel;
private JLabel itemNumberLabel;
private JLabel UnitAmountLabel;
private JLabel ItemvalueLabel;
private JLabel InventoryvalueLabel;
private JLabel RestockingfeeLabel;
private JLabel totalInventoryValueLabel;
private JFrame frame = new JFrame();
private TextArea text = new TextArea();
//frame.getContentPane();add(BorderLayout.WEST, JLabels);
// Labels constructor adds JLabels to JFrame
public Labels()
{
super( "Inventory Program" );
setLayout( new FlowLayout() ); // set frame layout
// JLabel constructor
text.setSize(50,485);
itemNameLabel = new JLabel("Name: ");
itemNameLabel.setToolTipText("Name Label ");
add( itemNameLabel ); // add bookTitleLabel to JFrame
itemNumberLabel = new JLabel("Item Number: ");
itemNumberLabel.setToolTipText("Item Number Label ");
add( itemNumberLabel ); // add itemNumberLabel to JFrame
UnitAmountLabel = new JLabel("UnitAmount: ");
UnitAmountLabel.setToolTipText("UnitAmount Label");
add( UnitAmountLabel ); // add bookUnitsLabel to JFrame
ItemvalueLabel = new JLabel("Item Price: ");
ItemvalueLabel.setToolTipText("Item Price Label");
add( ItemvalueLabel ); // add bookPriceLabel to JFrame
InventoryvalueLabel = new JLabel("Inventory Value: ");
InventoryvalueLabel.setToolTipText("Inventory Value Label");
add ( InventoryvalueLabel ); // add inventoryValueLabel to JFrame
RestockingfeeLabel = new JLabel("Restocking Fee: ");
RestockingfeeLabel.setToolTipText("Restocking Fee Label");
add( RestockingfeeLabel ); // add bookRestockingFeeLabel to JFrame
add(text);
text.setText(getstoreName());
} // end Label constructor
} // end class Labels
}
}
I know how to do a button for a single array button I so lost Im on my 7th file trying to figure out how to do this with a double array. I know im making this a lot harder then it real is but i think my brain stop working somewhere along the 5 file. well tell me what you guys think if its a lose or if i can use so type of loop. i think an if and a else loop would work or if i would just be better off going with a single array
thanks for the help and if it seems like im asking for code im sorry im not the best at wording this type of stuff.
•
•
•
•
I am also doing inventoy program 5 but my issue is that i have an double array.
an honestly i can think of a way to get the info to diplay one at a time because of this. i dont know if i would be better of swiching to a singal array or if i can do a if loop some how.
...<snipped>
Please post questions as a new thread and be sure to place code tags around all code that is posted. See the announcement at the top of the forum if you do not know how to use the code tags. Also, the coding conventions published by Sun are worth a read http://java.sun.com/docs/codeconv/ht...nvTOC.doc.html.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- PLEASE HELP about Using C# to add an executable file to my program! (C#)
- help with counting letters part of program (C++)
- VB Programming - Inventory Program (Visual Basic 4 / 5 / 6)
- WinXP installation program (Windows NT / 2000 / XP / 2003)
- Need help with this conversion program (C++)
- help writing a grep program (C)
- Moving IE to a different Program Folder (Windows NT / 2000 / XP / 2003)
- how can i make the program depend on time (C)
- cant remove program from ad and remove programs (Windows NT / 2000 / XP / 2003)
Other Threads in the Java Forum
- Previous Thread: Inventory part 6
- Next Thread: Pls Help Me!



Linear Mode