Page 1 of 2 12 LastLast
Results 1 to 20 of 22
  1. #1
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Cool E:\IT 215 Java Programming\InventoryGUI.java:20: cannot find symbol

    Hello everyone it me again. I have completed parts 3 and 4 on my own and the compile and are successful. Now I am working with GUI and its a little fuzzy to me but I only four errors and was wondering if you could help? So here goes.

    Java Code:
    import java.awt.Container;
    import java.awt.GridLayout;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    
    public class InventoryGUI {
    
        private GridLayout gridLayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
        private JFrame frame = null;
        private JLabel label = null;
        private JTextField textField = null;
    
        private Inventory inventory = null;
    
        public static final int MAXIMUM_ITEMS = 4;
        Product[] product = null;
    
        private String price = "";
    
        public InventoryGUI(Inventory inventory) {
            this.inventory = inventory;
        }
    
        public void createDisplayGUI() {
    
            // Create a JFrame container for all GUI widgets
                                frame = new JFrame("Inventory");
                                frame = new JFrame("Number");
                                frame = new JFrame("Name");
                                frame = new JFrame("Quantity");
                                frame = new JFrame("Price");
                                frame = new JFrame("Item Value");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
            // Set up default look and feel for particular Operating System
            JFrame.setDefaultLookAndFeelDecorated(true);
    
            // Set up the content pane and components in GridLayout
            Container container = frame.getContentPane();
            container.setLayout(gridLayout);
    
            // get the all the products in the inventory
             product = inventory.getProduct();
    
            // loop through all the products in the inventory and display them.
               for (int i=0; i < Inventory.MAXIMUM_ITEMS; i++) {
    
    
                // Define label widget
                  label = new JLabel(product[i].getName());
    
    
             Icon logo = new ImageIcon("C:/COMPANYLOGO.jpg");
             label = new JLabel(logo);
             label.setToolTipText("Company Logo");
    
    
                // Define textField widget
                price = Double.toString (product[i].getPrice());
                textField = new JTextField(price);
    
                // add widgets to JFrame
                container.add(label);
                container.add(textField);
    
                 //add buttons to JFrame
                  JButton add = new JButton("Add");
                  JButton delete = new JButton("Delete");
                  JButton modify = new JButton("Modify");
                  JButton first = new JButton("First");
                  JButton next = new JButton("Next");
                  JButton previous = new JButton("Previous");
                  JButton last = new JButton("Last");
            }
    
            // display the frame and all widgets within
            frame.pack();
            frame.setVisible(true);
        }
    }
    Well tell me what you think. I think that they are related mistakes if I solve the right one, the first one, everything else should fall into place.

  2. #2
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    I forgot the errors.
    Java Code:
    E:\IT 215 Java Programming\InventoryGUI.java:20: cannot find symbol
    symbol  : class Product
    location: class InventoryGUI
        Product[] product = null;
        ^
    E:\IT 215 Java Programming\InventoryGUI.java:12: cannot find symbol
    symbol  : variable MAXIMUM_ITEMS
    location: class Inventory
        private GridLayout gridLayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
                                                                ^
    E:\IT 215 Java Programming\InventoryGUI.java:47: cannot find symbol
    symbol  : method getProduct()
    location: class Inventory
             product = inventory.getProduct();
                                ^
    E:\IT 215 Java Programming\InventoryGUI.java:50: cannot find symbol
    symbol  : variable MAXIMUM_ITEMS
    location: class Inventory
               for (int i=0; i < Inventory.MAXIMUM_ITEMS; i++) {
                                          ^
    4 errors
    
    Tool completed with exit code 1

  3. #3
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    Java Code:
    E:\IT 215 Java Programming\InventoryGUI.java:20: '{' expected
        class Product[] product = null;
                     ^
    E:\IT 215 Java Programming\InventoryGUI.java:24: invalid method declaration; return type required
        public InventoryGUI(Inventory inventory) {
               ^
    E:\IT 215 Java Programming\InventoryGUI.java:84: reached end of file while parsing
    }
     ^
    3 errors
    
    Tool completed with exit code 1

  4. #4
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Try understanding what the errors are trying to tell you. Most of the time you are making elementary syntax errors.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  5. #5
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default Syntax errors look up!

    Quote Originally Posted by OrangeDog View Post
    Try understanding what the errors are trying to tell you. Most of the time you are making elementary syntax errors.
    That is just it I have tried looking at other projects that I have done and I can see where they are inconsistent but my brain hurts just thinking about it and I need a little push in the right direction. Thank you for your advice but I can not solve this by myself.

  6. #6
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    I have tried understanding the errors but what came out of it was: on the line that says Product [] product = null. To me it is an imcomplete statement and that I can try and work with but the compiler states that there is } missing somewhere on that line and I tried the beginning, the end of the line, and even on the line before it and got nothing in return. I will post the new responses in a few seconds. Thanks again.

  7. #7
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    Java Code:
    import java.awt.Container;
    import java.awt.GridLayout;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    
    public class InventoryGUI {
    
        private GridLayout gridLayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
        private JFrame frame = null;
        private JLabel label = null;
        private JTextField textField = null;
    
        private Inventory inventory = null;
    
        public static final int MAXIMUM_ITEMS = 4;{
        class Product[] product = null;
    
        private String price = "";
    
        public InventoryGUI(Inventory inventory) {
            this.inventory = inventory;
        }
    
        public void createDisplayGUI() {
    
            // Create a JFrame container for all GUI widgets
                                frame = new JFrame("Inventory");
                                frame = new JFrame("Number");
                                frame = new JFrame("Name");
                                frame = new JFrame("Quantity");
                                frame = new JFrame("Price");
                                frame = new JFrame("Item Value");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
            // Set up default look and feel for particular Operating System
            JFrame.setDefaultLookAndFeelDecorated(true);
    
            // Set up the content pane and components in GridLayout
            Container container = frame.getContentPane();
            container.setLayout(gridLayout);
    
            // get the all the products in the inventory
             product = inventory.getProduct();
    
            // loop through all the products in the inventory and display them.
               for (int label=0; label < 10000; label++) {
    
    
                // Define label widget
                  label = new JLabel(product[i].getName());
    
    
             Icon logo = new ImageIcon("C:/COMPANYLOGO.jpg");
             label = new JLabel(logo);
             label.setToolTipText("Company Logo");
    
    
                // Define textField widget
                price = Double.toString (product[i].getPrice());
                textField = new JTextField(price);
    
                // add widgets to JFrame
                container.add(label);
                container.add(textField);
    
                 //add buttons to JFrame
                  JButton add = new JButton("Add");
                  JButton delete = new JButton("Delete");
                  JButton modify = new JButton("Modify");
                  JButton first = new JButton("First");
                  JButton next = new JButton("Next");
                  JButton previous = new JButton("Previous");
                  JButton last = new JButton("Last");
            }
    
            // display the frame and all widgets within
            frame.pack();
            frame.setVisible(true);
        }
    }
    [errors]
    E:\IT 215 Java Programming\InventoryGUI.java:20: '{' expected
    class Product[] product = null;
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:24: invalid method declaration; return type required
    public InventoryGUI(Inventory inventory) {
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:84: reached end of file while parsing
    }
    ^
    3 errors
    [/errors]

    This is because on line 20 where it says Product [] Product = null; I put it into a class first and than reran it. Everything else if private maybe I should try running it as private or public. I'll try that

  8. #8
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    The dictionary says this illegal start of expression
    The error message will point to perfectly good code. Look just ahead of it for a missing } or ;
    static int x = 0; Static variables have to be defined outside all methods inside a class.
    you wrote x + = 2; instead of x += 2;
    you wrote case: STRAWBERRY instead of case STRAWBERRY :
    You nested a method inside another method.

  9. #9
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Question illegal start of expression

    To Whom It May Concern:
    I am having difficulties with a program that I am trying to only I am being asked to step and take a new perspective but the same picture is still there and never changes with every improvement that I make the picture just keeps getting worse. I think that I am going to SingBoyo help the for loop again but he is busy and I need this program turned in by Sunday. Every step I take like removing the public and class and privates and the adding them back just leads to more errors and its the only answer that I have learned so far. Is to remove the public or try to add the public or private or class. Class worked great for line 22 Product [] product = null; it got me down to only three mistakes but illegal start of expression is one that I can't solve. From whichever angle I try I just don't see it.

  10. #10
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    If the error messages haven't changed since you last posted them, this should be relevant.

    class Product[] product = null
    WHAT???
    If you just want something visible by the class, use private. If you want it visible by the package, dont put anything in. If you want it visible by classes extending it, use protected. If you want it visible by everything, use public.

    Not sure what is going wrong with the second error message. Probably has something to do with the squiggly bracket at the end of this line
    Java Code:
    public static final int MAXIMUM_ITEMS = 4;{
    Last error probably has something to do with the extra squiggly as well.

    Try changing the class in class Product[] product and removing the squiggly
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  11. #11
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    7

    Default

    E:\IT 215 Java Programming\InventoryGUI.java:20: cannot find symbol
    symbol : class Product
    location: class InventoryGUI
    Product[] product = null;
    ^
    Class product does not exist
    E:\IT 215 Java Programming\InventoryGUI.java:12: cannot find symbol
    symbol : variable MAXIMUM_ITEMS
    location: class Inventory
    private GridLayout gridLayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
    ^
    the variable MAXIMUM_ITEMS is not in the class Inventory, but in InventoryGUI.
    E:\IT 215 Java Programming\InventoryGUI.java:47: cannot find symbol
    symbol : method getProduct()
    location: class Inventory
    product = inventory.getProduct();
    ^
    There is no getProduct method in the class Inventory
    E:\IT 215 Java Programming\InventoryGUI.java:50: cannot find symbol
    symbol : variable MAXIMUM_ITEMS
    location: class Inventory
    for (int i=0; i < Inventory.MAXIMUM_ITEMS; i++) {
    the variable MAXIMUM_ITEMS is not in the class Inventory, but in InventoryGUI.
    E:\IT 215 Java Programming\InventoryGUI.java:20: '{' expected
    class Product[] product = null;
    ^
    What boyo said, this is an illegal statement. (You DO know how to create a class, i suppose?)
    E:\IT 215 Java Programming\InventoryGUI.java:24: invalid method declaration; return type required
    public InventoryGUI(Inventory inventory) {
    ^
    Has to with the bracket after the declaration of the variable MAXIMUM_ITEMS
    E:\IT 215 Java Programming\InventoryGUI.java:84: reached end of file while parsing
    }
    ^
    Same

    That helped?


    ~Matt
    I die a little on the inside...
    Every time I get shot.

  12. #12
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Red face errors

    Quote Originally Posted by Supamagier View Post
    Class product does not exist

    the variable MAXIMUM_ITEMS is not in the class Inventory, but in InventoryGUI. So do you mean to type in InventoryGUI and it should work?

    There is no getProduct method in the class Inventory. I did not think that the for loop was good but tried it anyway. I just have a problem with for loops being difficult for me and I always get them wrong.

    the variable MAXIMUM_ITEMS is not in the class Inventory, but in InventoryGUI. Same thing type in InventoryGUI.

    What boyo said, this is an illegal statement. (You DO know how to create a class, i suppose?) You create a class by placing class in front of the jargin.

    Has to with the bracket after the declaration of the variable MAXIMUM_ITEMS
    The bracket after MAXIMUM_ITEMS has not changed.. But some things have.
    Same

    That helped?


    ~Matt
    Java Code:
    import java.awt.Container;
    import java.awt.GridLayout;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    
    public class InventoryGUI {
    
        private GridLayout
        GridLayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
        private JFrame frame = null;
        private JLabel label = null;
        private JTextField textField = null;
    
        private Inventory inventory = null;
    
        public static final int MAXIMUM_ITEMS = 4;{
             Product[] productinventory = null;
    
         private String price = "";}
    
         public InventoryGUI(inventory.inventory); {
            this.inventory = inventory;
        }
    
          public void createDisplayGUI(); {
    
            // Create a JFrame container for all GUI widgets
                                frame = new JFrame("Inventory");
                                frame = new JFrame("Number");
                                frame = new JFrame("Name");
                                frame = new JFrame("Quantity");
                                frame = new JFrame("Price");
                                frame = new JFrame("Item Value");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
            // Set up default look and feel for particular Operating System
            JFrame.setDefaultLookAndFeelDecorated(true);
    
            // Set up the content pane and components in GridLayout
            Container container = frame.getContentPane();
            container.setLayout(gridLayout);
    
            // get the all the products in the inventory
             product = inventory.getProduct();
    
            // loop through all the products in the inventory and display them.
               for (int label=0; label < 10000; label++) {
    
    
                // Define label widget
                  label = new JLabel(product[i].getName());
    
    
             Icon logo = new ImageIcon("C:/COMPANYLOGO.jpg");
             label = new JLabel(logo);
             label.setToolTipText("Company Logo");
    
    
                // Define textField widget
                price = Double.toString (product[i].getPrice());
                textField = new JTextField(price);
    
                // add widgets to JFrame
                container.add(label);
                container.add(textField);
    
                 //add buttons to JFrame
                  JButton add = new JButton("Add");
                  JButton delete = new JButton("Delete");
                  JButton modify = new JButton("Modify");
                  JButton first = new JButton("First");
                  JButton next = new JButton("Next");
                  JButton previous = new JButton("Previous");
                  JButton last = new JButton("Last");
            }
    
            // display the frame and all widgets within
            frame.pack();
            frame.setVisible(true);
        }
    }
    }
    [errors]
    E:\IT 215 Java Programming\InventoryGUI.java:23: illegal start of expression
    private String price = "";}
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:25: <identifier> expected
    public InventoryGUI(inventory.inventory); {
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:86: class, interface, or enum expected
    }
    ^
    3 errors

    Tool completed with exit code 1
    [/errors]

    I have been racking my brain all night and this is what I got. Down to three errors but still no success in the future. Take a look at this one. I would say that intuitively I used all of your suggestions and this is what is left.

  13. #13
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    Thank you both Singboyo and Supamagier. You have been more than helpful.

  14. #14
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default response

    Quote Originally Posted by Supamagier View Post
    Class product does not exist

    the variable MAXIMUM_ITEMS is not in the class Inventory, but in InventoryGUI.

    There is no getProduct method in the class Inventory

    the variable MAXIMUM_ITEMS is not in the class Inventory, but in InventoryGUI.

    What boyo said, this is an illegal statement. (You DO know how to create a class, i suppose?)

    Has to with the bracket after the declaration of the variable MAXIMUM_ITEMS

    Same


    That helped?


    ~Matt
    I will use these for future reference because I am sure they will turn up again. When ever I try to make corrections it reverts back to this form. So I will write down your suggestions for future reference. Thanks again.
    I will use these for future reference because I am sure that they will come up again.

  15. #15
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    When I changed Inventory to InventoryGUI noting happens but when I remove } from lines 23 or 25 I get 37 errors.

  16. #16
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Thumbs up [solved]

    Quote Originally Posted by tlouvierre View Post
    When I changed Inventory to InventoryGUI noting happens but when I remove } from lines 23 or 25 I get 37 errors.
    Thank you for all of your help. Some programs were not ment to be solved. I had to start from scratch and I was successful. If you would like I can share with everyone or not. Now I am working on part 5. Write back later.

  17. #17
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    Java Code:
    public class GUI1 extends JFrame implements ActionListener {
    
         private JTextArea output;
         private int current = 0;
         private Inventory inv;
         private JButton next;
    
         public GUI1() {
              super("Product GUI");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // end the program when we are done
    
              // number of products...
              int number = Integer.parseInt(JOptionPane.showInputDialog("Please tell me the number of products to enter"));
    
              // Set up the inventory
              inv = new Inventory(number);
    
              // enter the product info using a series of dialogs
              for (int i = 0; i < number; i++) {
                   int item = Integer.parseInt(JOptionPane.showInputDialog("Enter the item's number"));
    
                   String name = JOptionPane.showInputDialog("Enter the item's name");
    
                   int units = Integer.parseInt(JOptionPane.showInputDialog("Enter the units in stock"));
    
                   double price = Double.parseDouble(JOptionPane.showInputDialog("Enter the price of each item"));
    
                   String title = JOptionPane.showInputDialog("Enter the title");
    
                   // make the object
                   CD p = new CD(item, name, units, price, title);
    
                   // put it in the inventory
                   inv.add(i,p);
              }
    
              // Sort the inv
              inv.sort();
    
              // now popup the "real" gui for the display of the products...
              JPanel content = new JPanel();
              setContentPane(content);
    
              content.setLayout(new BoxLayout(content,BoxLayout.Y_AXIS));
    
              output = new JTextArea(20,50);
              output.setEditable(false);
              content.add(output);
    
              next = new JButton("Next");
              next.setActionCommand("Next");
              next.addActionListener(this);
              content.add(next);
    
              if (inv.size() > 0)
                   display(inv.get(0));
              else {
                   next.setText("End");
                   next.setEnabled(false);
              }
              if (current == inv.size()-1) {
                   next.setText("End");
                   next.setEnabled(false);
              }
    
         }
    
         // button pushes...
         public void actionPerformed(ActionEvent evt) {
              if (evt.getActionCommand().equals("Next")) {
                   if (current < inv.size()-1) {
                        current++;
                        CD p = inv.get(current);
                        display(p);
                   }
                   if (current == inv.size()-1) {
                        next.setText("End");
                        next.setEnabled(false);
                   }
              }
         }import java.util;
    
    
         // show a record
         public void display(CD p) {
              String str = "";
              str += "Item number: " + p.getItem() + "\n";
              str += "Item name: " + p.getName() + "\n";
              str += "Items in stock: " + p.getUnits() + "\n";
              str += "Price: $" + p.getPrice() + "\n";
              str += "Fee: $" + (p.value() - p.value()/1.05) + "\n";
              str += "Value (including the fee): $" + p.value() + "\n";
    
              // total value of it
              str += "Total fee: $" + (inv.totalValue() - inv.totalValue()/1.05) + "\n";
              str += "Total value (including the fee): $" + inv.totalValue() + "\n";
              output.setText(str);
         }
    
         public static void main(String args[]) {
              // setup and display the gui
              GUI1 g = new GUI1();
              g.pack();
              g.setVisible(true);
         }
    }
     class CD extends Product {
    
         // title of the DVD
         private String title;
    
         // constructor
         public CD(int item, String name, int units, double price, String title) {
              super(item,name,units, price);
              this.title = title;
         }
    
         public String getTitle() {
              return title;
         }
    
         // total value with the 5% fee
         public double value() {
              return super.value()*1.05;
         }
    }
    public class Inventory {
         // Stores multiple products...
    
         private CD[] prods; // field
    
         // Constructor, based on the size of the array we want
         public Inventory(int size) {
              prods = new CD[size];
         }
    
         // Add a product
         public void add(int loc, CD p) {
              prods[loc] = p;
         }
    
         // getter for a product
         public CD get(int loc) {
              return prods[loc];
         }
    
         // sort the array!
         public void sort() {
              Arrays.sort(prods);
         }
    
         public int size() {
              return prods.length;
         }
    
         // Total the value of all the products
         public double totalValue() {
              double val = 0.0;
              for (int i = 0; i < prods.length; i++) {
                   val += prods.value();
              }
              return val;
         }
    }
    // Stores a Product
    public class Product implements Comparable {
    
         // fields
         private int item;
         private String name;
         private int units;
         private double price;
    
         // constructor
         public Product(int item, String name, int units, double price) {
              this.item = item;
              this.name = name;
              this.units = units;
              this.price = price;
         }
    
         // total value
         public double value() {
              return units*price;
         }
    
         // getters and setters
    
         public int getItem() {
              return item;
         }
    
         public void setItem(int item) {
              this.item = item;
         }
    
         public String getName() {
              return name;
         }
    
         public void setName(String name) {
              this.name = name;
         }
    
         public int getUnits() {
              return units;
         }
    
         public void setUnits(int units) {
              this.units = units;
         }
    
         public double getPrice() {
              return price;
         }
    
         public void setPrice(double price) {
              this.price = price;
         }
    
         // for the sorting
         public int compareTo(Object p) {
              final Product o = (Product)p; // make it a product
              return (this.getName().compareToIgnoreCase(o.getName())); // compare the names
         }
    
    }
    [errors]
    E:\IT 215 Java Programming\GUI1.java:81: illegal start of type
    }import java.util;
    ^
    E:\IT 215 Java Programming\GUI1.java:81: ';' expected
    }import java.util;
    ^
    E:\IT 215 Java Programming\GUI1.java:81: illegal start of type
    }import java.util;
    ^
    3 errors

    Tool completed with exit code 1
    This sounds very simple but its not. Oh, by the way I am one program away from being finished and I owe it all to you guys and girls out there JAVALAND. Thank you

  18. #18
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    7

    Default

    Java Code:
    private GridLayout
        GridLayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
    What? That's wrong, use
    Java Code:
    private GridLayout gridlayout = new GridLayout(Inventory.MAXIMUM_ITEMS,2);
    instead.


    Java Code:
    public static final int MAXIMUM_ITEMS = 4;{
             Product[] productinventory = null;
    
         private String price = "";}
    What are those brackets doing there? remove'em

    Java Code:
    public InventoryGUI(inventory.inventory); {
            this.inventory = inventory;
        }
    What's that semicolon doing there? (before the bracket). Remove it

    Java Code:
    for (int label=0; label < 10000; label++) {
    
    
                // Define label widget
                  label = new JLabel(product[i].getName());
    
    
             Icon logo = new ImageIcon("C:/COMPANYLOGO.jpg");
             label = new JLabel(logo);
             label.setToolTipText("Company Logo");
    
    
                // Define textField widget
                price = Double.toString (product[i].getPrice());
                textField = new JTextField(price);
    
                // add widgets to JFrame
                container.add(label);
                container.add(textField);
    
                 //add buttons to JFrame
                  JButton add = new JButton("Add");
                  JButton delete = new JButton("Delete");
                  JButton modify = new JButton("Modify");
                  JButton first = new JButton("First");
                  JButton next = new JButton("Next");
                  JButton previous = new JButton("Previous");
                  JButton last = new JButton("Last");
            }
    What... exactly are you trying to accomplish with that loop, that won't compile anyway. remove the for statement and the bracket at the end of this code snippet.

    Java Code:
    }
    }
    (At the end)
    That's one bracket too many.

    I could go on for a while, but I have other things to do. ;)

    But seriously mate, you should learn what the errors mean.
    Last edited by Supamagier; 05-31-2009 at 11:43 AM.
    I die a little on the inside...
    Every time I get shot.

  19. #19
    tlouvierre is offline Member
    Join Date
    Apr 2009
    Location
    I live Stafford Texas right outside of Houston.
    Posts
    78
    Rep Power
    0

    Default

    I have tried all of your suggestions and I thinkg that this program is hopeless. Because it solved some errors but more occured. look..
    [code]
    E:\IT 215 Java Programming\InventoryGUI.java:24: illegal start of expression
    private String price = "";}
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:31: illegal start of expression
    public void createDisplayGUI(); {
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:31: illegal start of expression
    public void createDisplayGUI(); {
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:31: ';' expected
    public void createDisplayGUI(); {
    ^
    E:\IT 215 Java Programming\InventoryGUI.java:85: reached end of file while parsing
    }
    ^
    5 errors

    Tool completed with exit code 1

  20. #20
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Yes, because you're still doing the same things wrong over and over again.

    Start again from here.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

Page 1 of 2 12 LastLast

Similar Threads

  1. cannot find symbol
    By GabWit in forum New To Java
    Replies: 3
    Last Post: 01-25-2009, 01:13 AM
  2. java:34:cannot find symbol
    By MissyMadi in forum New To Java
    Replies: 5
    Last Post: 11-09-2008, 07:53 PM
  3. Replies: 9
    Last Post: 10-18-2008, 09:26 PM
  4. Replies: 3
    Last Post: 05-01-2008, 09:30 AM
  5. [SOLVED] Java Error: Cannot find Symbol...
    By bobleny in forum New To Java
    Replies: 8
    Last Post: 04-15-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •