import java.awt.*;
import java.awt.event.*;
import java.swing.*;
import java.util.*;
public class Main extends JFrame implements ActionListener {
private DefaultListModel mod1=new DefaultListModel(),
private DefaultListModel mod2=new DefaultListModel();
private JList 11 = new JList(mod1),
private JList 12 = new JList(mod2);
private JButton to=new JButton(">>"),
delete=new JButton("<<"),
ord=new JButton("order");
private JLabel costLabel=new JLabel("Total Cost: $0");
private int no;
public order() throws IOException {
JPanel arrows=new JPanel();
arrows.setLayout(new GridLayout(2, 1, 0, 10));
arrows.add(to); arrows.add(delete);
JPanel row1=new JPanel(), row2=new JPanel();
getContentPane().add(row1, BorderLayout.Center);
getContentPane().add(row2, BorderLayout.South);
JScrollPane sp1=new JScrollPane(11),
JScrollPane sp2=new JScrollPane(12);
row.add(sp1); row1.add(arrows); row1.add(sp2);
row2.add(costLabel); row2.add(ord);
BufferedReader file=new BufferedReader(
new fileReader("titles.txt"));
String line;
while ((line=file.readLine())!=null)


Edited by happygeek: fixed formatting

9 Years
Discussion Span
Last Post by jonbc86

to the above code i am trying to create a program that the user can select an item off the menu and then off to the right it will say that the item was purchased then tally it up for a bill total. Followed by spitting out a random order number then asking the user whether they would like to use cash or credit card. The user will then type in a credit card if it matches the one that is already in the code then it will say accepted and billed. Thanks again to anyone who can help


private JList 11 = new JList(mod1),
private DefaultListModel mod1=new DefaultListModel(),

for those two lines net beans, command prompt, and Blue J are all saying identifier error.

Got anything ? Ideas? or how i might go to finishing this project?


private DefaultListModel mod1=new DefaultListModel(),

private JList l1 = new JList(mod1),


see what the program is suppose to do is this.
Java program with a menu of 6 items.
-each of the 6 items has a check box
-when the food is selected it appears to the right saying that so n so was selected.
-then i just need a welcome screen before that to introduce the program
-then the user needs to select either cash or credit card.
-upon this selection a random order number needs to pop up and appear.
-if they choose credit card it needs to be accepted by a built in number in the code.
thats it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.