Results 1 to 12 of 12
  1. #1
    amelia22 is offline Member
    Join Date
    Aug 2013
    Posts
    7
    Rep Power
    0

    Unhappy Java won't make class file

    I attempted to compile and run it but it won't run :( it just show "exception in thread "main" java.lang.NoClassDefFoundError:" and when I checked the folder where my java file is, there is no class file created....... I don't know what to do anymore..
    Attached Thumbnails Attached Thumbnails Java won't make class file-capture.png  
    Attached Files Attached Files

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    3,383
    Rep Power
    5

    Default Re: Java won't make class file

    In the future, please paste your code in the thread between [code][/code] tags. I have done it here for you.

    The class with main in it is CashTillAyson so put this in a file called CashTillAyson.java Then do:

    javac CashTillAyson.java
    java CashTillAyson


    Regards,
    Jim


    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    
    class CashTillAyson extends JFrame implements ActionListener
    {
    	 JFrame mainFrame = new JFrame("Cash Till");
    	 JFrame inventoryFrame = new JFrame("Inventory List");
    	 JFrame saleFrame = new JFrame("Perform a Sale");
    	 JFrame buyFrame = new JFrame();
    	 Font font1 = new Font("Arial", Font.PLAIN,20);
    	 Font font2 = new Font("Arial", Font.PLAIN, 17);
    	 Font font3 = new Font("Times New Roman", Font.BOLD, 16);
    	 JPanel panel1 = new JPanel();
    	 JPanel salePanel = new JPanel();
    	 JPanel salePanel2 = new JPanel();
    	 JPanel buyPanel = new JPanel();
    	 JTextField field1 = new JTextField(3);
    	 JTextField saleField = new JTextField(5);
    	 JTextField buyField = new JTextField(2);
    	 JButton mainButton = new JButton("Enter");
    	 JButton mainMenuButton = new JButton("Return to Main Menu");
    	 JButton saleButton = new JButton("Select");
    	 JButton buyButton = new JButton("Add to Cart");
    	 JButton finalBuyButton = new JButton("BUY");
    	 JOptionPane disp = new JOptionPane();
    	 JLabel itemNameLabel = new JLabel();
    	 JLabel qty = new JLabel("Quantity:");
    	 JLabel mainLabel = new JLabel("Main Menu");
    	 JLabel SelectionLabel = new JLabel("Enter Selection:");
    	 JLabel label6 = new JLabel();
    	 JLabel itemChoiceLabel = new JLabel();
    	 JLabel receiptLabel = new JLabel();
    	 JLabel saleLabel = new JLabel("Enter Item Code: ");
    	 JTextArea mainArea = new JTextArea("1. Perform a Sale\n"+
    					"2. List Inventory\n"+
    					"3. Quit Program\n");
    	 JTextArea receiptArea = new JTextArea();
    	 public int stock1=150,stock2=100,stock3=125,stock4=200,stock5=50,stock6=75,stock7=100,stock8=90,stock9=115,stock10=80;
    	 public int totalItems;
    	 double price1=120.00,price2=130.00,price3=130.00,price4=120.00,price5=100.00,price6=1999.99,price7=299.99,price8=149.99,price9=1299.99,price10=1499.99;
    	 public double choicePrice, subTotalPrice,totalPrice;
    	 public String itemChoice,itemChoiceName;
    	 private final static String newline = "\n";
    	 private final String times = " x ";
    	 private final String equals = " = ";
    
    	 public void MainMenu()
    	 {
    	 	 field1.setText(null);
    	 	 panel1.setLayout(null);
    	 	 mainLabel.setFont(font1);
    	 	 mainLabel.setBounds(100,15,100,15);
    	 	 mainArea.setFont(font2);
    	 	 mainArea.setEditable(false);
    	 	 mainArea.setBounds(40,60,135,60);
    	 	 SelectionLabel.setBounds(80,127,90,35);
    	 	 field1.setBounds(175,130,50,30);
    	 	 mainButton.setBounds(95,190,100,35);
    	 	 panel1.add(mainLabel);
    	 	 panel1.add(mainArea);
    	 	 panel1.add(SelectionLabel);
    	 	 panel1.add(field1);
    	 	 panel1.add(mainButton);
    	 	 mainButton.addActionListener(this);
    	 	 mainFrame.add(panel1);
    	 	 mainFrame.setSize(300,300);
    	 	 mainFrame.setResizable(false);
    	 	 mainFrame.setVisible(true);
    	 	 mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	 	 mainMenuButton.addActionListener(this);
    		 buyButton.addActionListener(this);
    		 receiptArea.setText(null);
           	 }//MainMenu
    
           	 public static void main(String[] args)
    	 {
    	 	 CashTillAyson frame = new CashTillAyson();
    	 	 frame.MainMenu();
    	 }//main
    
    	 public void actionPerformed(ActionEvent e)
    	 {
    	 	 Object buttonClicked = e.getSource();
    	 	 if(buttonClicked == mainButton)
    	 	 {
    	 		 String inputMain = field1.getText();
    	 		 int choice = Integer.parseInt(inputMain);
    	 		 if(choice == 1)
    	 		 {
    	 			label6.setText("Perform a Sale");
    	 			PerformSale();
    	 		 }
    	 		 else if(choice == 2)
    	 		 {
    	 			label6.setText("List Inventory");
    	 			InventoryList();
    	 		 }
    	 		 else if(choice == 3)
    	 		 {
    	 			System.exit(0);
    	 		 }
    	 		 else
    	 			disp.showMessageDialog(null, "Invalid Input. Choose 1, 2 or 3");
    
    	 	 }//buttonClicked == mainButton
    	 	 else if(buttonClicked == mainMenuButton)
    	 	 {
    	 		 saleFrame.setVisible(false);
    	 		 inventoryFrame.setVisible(false);
    	 		 buyButton.removeActionListener(this);
    	 		 MainMenu();
    	 		 finalBuyButton.removeActionListener(this);
    	 	 }
    	 	 else if(buttonClicked == saleButton)
    	 	 {
    	 		 itemChoice = saleField.getText();
    	 		 if(itemChoice.equals("00001"))
    	 		 {
    	 			 itemChoiceName = "LoL Jungler Baller";
    				 choicePrice = price1;
    			 }
    	 		 else if(itemChoice.equals("00012"))
    	 		 {
    	 			 itemChoiceName = "LoL ADC Baller";
    	 			 choicePrice = price2;
    			 }
    	 		 else if(itemChoice.equals("00123"))
    	 		 {
    	 			 itemChoiceName = "LoL APC Baller";
    				 choicePrice = price3;
    		 	 }
    	 		 else if(itemChoice.equals("01234"))
    	 		 {
    	 			 itemChoiceName = "LoL Solo Top Baller";
    			 	 choicePrice = price4;
    			 }
    	 		 else if(itemChoice.equals("12345"))
    	 		 {
    	 			 itemChoiceName = "LoL Support Baller";
    	 			 choicePrice = price5;
    			 }
    	 		 else if(itemChoice.equals("23456"))
    	 		 {
    	 			 itemChoiceName = "Blitzcrank Hoodie";
    	 			 choicePrice = price6;
    			 }
    	 		 else if(itemChoice.equals("34567"))
    	 		 {
    	 			 itemChoiceName = "LoL T-Shirt";
    	 			 choicePrice = price7;
    			 }
     	 		 else if(itemChoice.equals("45678"))
     	 		 {
    	 			 itemChoiceName = "LoL Lanyard";
    	 			 choicePrice = price8;
    			 }
    	 		 else if(itemChoice.equals("56789"))
    	 		 {
    	 			 itemChoiceName = "LoL Teemo hat";
    	 			 choicePrice = price9;
    			 }
    	 		 else if(itemChoice.equals("67890"))
    	 		 {
    	 			 itemChoiceName = "LoL Rammus hat";
    	 			 choicePrice = price10;
    		 	 }
    	 		 BuyItem();
    	 	 }
    	 	 else if(buttonClicked == buyButton)
    	 	 {
    			 buyFrame.setVisible(false);
    			 String itemQty = buyField.getText();
    			 totalItems = Integer.parseInt(itemQty);
    			 subTotalPrice = totalItems * choicePrice;
    			 totalPrice+=subTotalPrice;
    			 receiptArea.append(itemChoiceName + times + totalItems + equals + subTotalPrice +  newline);
    			 System.out.println(" "+ itemChoiceName + subTotalPrice + totalPrice);
    	 	 }
    	 	 else if(buttonClicked == finalBuyButton)
    	 	 {
     			 if(itemChoice.equals("00001"))
    	 		 {
    	 			 stock1-=totalItems;
    	 			 System.out.println(" "+ stock1);
    			 }
    	 		 else if(itemChoice.equals("00012"))
    	 		 {
    	 			 stock2-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("00123"))
    	 		 {
    	 			 stock3-=totalItems;
    		 	 }
    	 		 else if(itemChoice.equals("01234"))
    	 		 {
    	 			 stock4-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("12345"))
    	 		 {
    	 			 stock5-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("23456"))
    	 		 {
    	 			 stock6-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("34567"))
    	 		 {
    	 			 stock7-=totalItems;
    			 }
     	 		 else if(itemChoice.equals("45678"))
     	 		 {
    	 			 stock8-=totalItems;;
    			 }
    	 		 else if(itemChoice.equals("56789"))
    	 		 {
    	 			 stock9-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("67890"))
    	 		 {
    	 			 stock10-=totalItems;;
    		 	 }
    	 	 }
    
    	 		 setVisible(false);
    	 }//actionPerformed
       	 public void PerformSale()
       	 {
    	 	    saleButton.addActionListener(this);
    	 	    finalBuyButton.addActionListener(this);
    	  		salePanel.setLayout(null);
    	  		saleLabel.setFont(font3);
    	  		saleLabel.setBounds(15,5,120,30);
    	  		saleField.setBounds(140,8,50,27);
    	  		saleButton.setBounds(190,5,75,30);
    	  		receiptArea.setBounds(25,75,200,200);
    	  		mainMenuButton.setBounds(105,370,170,30);
    	  		finalBuyButton.setBounds(10,370,90,30);
    	  		salePanel.add(saleLabel);
    	  		salePanel.add(saleField);
    	  		salePanel.add(saleButton);
    	  		salePanel.add(receiptArea);
    	  		salePanel.add(finalBuyButton);
    	  		salePanel.add(mainMenuButton);
    	  		saleFrame.add(salePanel);
    			saleFrame.setSize(300,450);
    	  		saleFrame.setVisible(true);
    	  		receiptArea.setEditable(false);
    	 }//PerformSale
    
       	 public void InventoryList()
    	 {
    		   	String[] columnNames = {"Item", "Item Code", "Stocks Left","Price"};
    		 	Object[][] data = {
    		            {"LoL Jungler Baller","00001",stock1,price1},
    		            {"LoL ADC Baller","00012",stock2,price2},
    		            {"LoL APC Baller","00123",stock3,price3},
    		            {"LoL Solo Top Baller","01234",stock4,price4},
    					{"LoL Support Baller","12345",stock5,price5},
    		            {"Blitzcrank hoodie","23456",stock6,price6},
    		            {"LoL T-Shirt","34567",stock7,price7},
    					{"LoL Lanyard","45678",stock8,price8},
    		            {"LoL Teemo hat","56789",stock9,price9},
    		            {"LoL Rammus hat","67890",stock10,price10}
    		            };
    		 	JTable table = new JTable(data,columnNames);
    
    			table.setGridColor(Color.BLACK);
    			table.setAutoCreateRowSorter(true);
    	        table.getColumnModel().getColumn(0).setPreferredWidth(110);
    		 	table.getColumnModel().getColumn(1).setPreferredWidth(110);
    		 	table.getColumnModel().getColumn(2).setPreferredWidth(110);
    	 		table.getColumnModel().getColumn(3).setPreferredWidth(110);
    	 		table.setRowHeight(25);
    	 		JScrollPane spTable = new JScrollPane(table);
    
    	 		inventoryFrame.add(spTable);
    			inventoryFrame.add(mainMenuButton,BorderLayout.PAGE_END);
    	  		inventoryFrame.setSize(500,420);
    	 		inventoryFrame.setVisible(true);
    	 }//public void InventoryList
    
    	 public void BuyItem()
    	 {
    		itemNameLabel.setText(" "+ itemChoiceName);
    		buyPanel.setLayout(null);
    		itemNameLabel.setBounds(5,2,150,20);
    		qty.setBounds(45,40,80,20);
    		buyField.setBounds(100,40,30,24);
    		buyButton.setBounds(55,70,70,30);
    		buyPanel.add(itemNameLabel);
    		buyPanel.add(qty);
    		buyPanel.add(buyField);
    		buyPanel.add(buyButton);
    		buyFrame.add(buyPanel);
    		buyFrame.setSize(190,150);
    		buyFrame.setVisible(true);
    		buyFrame.setResizable(false);
    		buyFrame.setAlwaysOnTop(true);
    	 }//BuyItem
    }//CashTill
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    amelia22 is offline Member
    Join Date
    Aug 2013
    Posts
    7
    Rep Power
    0

    Default Re: Java won't make class file

    Oh.. okay :D thanks

  4. #4
    amelia22 is offline Member
    Join Date
    Aug 2013
    Posts
    7
    Rep Power
    0

    Default Re: Java won't make class file

    Mind if I ask.. as you saw, there were many pop-up windows on my program as you choose among the choices, right? how can I reduce them?? I only want one window to show up but the choices pops more windows.. please help me again.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Java won't make class file

    You need to go through this tutorial: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    amelia22 is offline Member
    Join Date
    Aug 2013
    Posts
    7
    Rep Power
    0

    Default Re: Java won't make class file

    Can't someone just give me the code to it instead? I have to pass that code by 6pm and I'm not halfway through

  7. #7
    amelia22 is offline Member
    Join Date
    Aug 2013
    Posts
    7
    Rep Power
    0

    Default Re: Java won't make class file

    ok I managed to do it but it was wrong... HELP ME CORRECT THIS PLEASE !!

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    
    class Joyo extends JFrame implements ActionListener
    {
    	 JFrame mainFrame = new JFrame("Cash Till");
    	 //JFrame inventoryFrame = new JFrame("Inventory List");
    	 //JFrame saleFrame = new JFrame("Perform a Sale");
    	 JFrame buyFrame = new JFrame();
    	 Font font1 = new Font("Arial", Font.PLAIN,20);
    	 Font font2 = new Font("Arial", Font.PLAIN, 17);
    	 Font font3 = new Font("Times New Roman", Font.BOLD, 16);
    	 JPanel panel1 = new JPanel();
    	 JPanel salePanel = new JPanel();
    	 JPanel salePanel2 = new JPanel();
    	 JPanel buyPanel = new JPanel();
    	 JTextField field1 = new JTextField(3);
    	 JTextField saleField = new JTextField(5);
    	 JTextField buyField = new JTextField(2);
    	 JButton mainButton = new JButton("Enter");
    	 JButton mainMenuButton = new JButton("Return to Main Menu");
    	 JButton saleButton = new JButton("Select");
    	 JButton buyButton = new JButton("Add to Cart");
    	 JButton finalBuyButton = new JButton("BUY");
    	 JOptionPane disp = new JOptionPane();
    	 JLabel itemNameLabel = new JLabel();
    	 JLabel qty = new JLabel("Quantity:");
    	 JLabel mainLabel = new JLabel("Otaku");
    	 JLabel SelectionLabel = new JLabel("Enter Selection:");
    	 JLabel label6 = new JLabel();
    	 JLabel itemChoiceLabel = new JLabel();
    	 JLabel receiptLabel = new JLabel();
    	 JLabel saleLabel = new JLabel("Enter Item Code: ");
    	 JTextArea mainArea = new JTextArea("1. Perform a Sale\n"+
    					"2. Inventory\n"+
    					"3. Exit\n");
    	 JTextArea receiptArea = new JTextArea();
    
    	 public int 
    
    stock1=200,stock2=200,stock3=200,stock4=200,stock5=200,stock6=200,stock7=200,
    
    stock8=200,stock9=200,stock10=200,stock11=200,stock12=200,stock13=200,stock14
    
    =200,stock15=200,stock16=200,stock17=200,stock18=200,stock19=200,stock20=200;
    
    	 public int totalItems;
    	 double 
    
    price1=1200.00,price2=500.00,price3=600.00,price4=4500.00,price5=1000.00,pric
    
    e6=699.75,price7=699.75,price8=6000.00,price9=2000.00,price10=200.00,price11=
    
    2000.00,price12=7000.00,price13=900.00,price14=200.00,price15=500.00,price16=
    
    5000.00,price17=1300.00,price18=20000.00,price19=1900.00,price20=3400.00;
    
    	 public double choicePrice, subTotalPrice,totalPrice;
    	 public String itemChoice,itemChoiceName;
    	 private final static String newline = "\n";
    	 private final String times = " x ";
    	 private final String equals = " = ";
    
    	 public void MainMenu()
    	 {
    	 	 field1.setText(null);
    	 	 panel1.setLayout(null);
    	 	 mainLabel.setFont(font1);
    	 	 mainLabel.setBounds(100,15,100,20);
    	 	 mainArea.setFont(font2);
    	 	 mainArea.setEditable(false);
    	 	 mainArea.setBounds(40,60,135,60);
    	 	 SelectionLabel.setBounds(80,127,90,35);
    	 	 field1.setBounds(175,130,50,30);
    	 	 mainButton.setBounds(95,190,100,35);
    	 	 panel1.add(mainLabel);
    	 	 panel1.add(mainArea);
    	 	 panel1.add(SelectionLabel);
    	 	 panel1.add(field1);
    	 	 panel1.add(mainButton);
    	 	 mainButton.addActionListener(this);
    	 	 mainFrame.add(panel1);
    	 	 mainFrame.setSize(300,300);
    	 	 mainFrame.setResizable(false);
    	 	 mainFrame.setVisible(true);
    	 	 mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	 	 mainMenuButton.addActionListener(this);
    		 buyButton.addActionListener(this);
    		 receiptArea.setText(null);
           	 
    	}//MainMenu
    
    
    
    
    
           	 public static void main(String[] args)
    	 {
    	 	 Joyo frame = new Joyo();
    	 	 frame.MainMenu();
    
    	 }//main
    
    
    
    	 public void actionPerformed(ActionEvent e)
    	 {
    	 	 Object buttonClicked = e.getSource();
    	 	 if(buttonClicked == mainButton)
    	 	 {
    	 		 String inputMain = field1.getText();
    	 		 int choice = Integer.parseInt(inputMain);
    	 		 if(choice == 1)
    	 		 {
    	 			label6.setText("Perform a Sale");
    	 			PerformSale();
    	 		 }
    	 		 else if(choice == 2)
    	 		 {
    	 			label6.setText("List Inventory");
    	 			InventoryList();
    	 		 }
    	 		 else if(choice == 3)
    	 		 {
    				QuitProgram();
    	 			System.exit(0);
    	 		 }
    	 		 else
    	 			disp.showMessageDialog(null, "Please Choose 
    
    from the Choises. Thank You!");
    
    
    	 	 }//buttonClicked == mainButton
    
    
    	 	 else if(buttonClicked == mainMenuButton)
    	 	 {
    	 		 mainFrame.setVisible(false);
    	 		 mainFrame.setVisible(false);
    	 		 buyButton.removeActionListener(this);
    	 		 MainMenu();
    	 		 finalBuyButton.removeActionListener(this);
    	 	 }
    	 	 else if(buttonClicked == saleButton)
    	 	 {
    	 		 itemChoice = saleField.getText();
    	 		 if(itemChoice.equals("14573"))
    	 		 {
    	 			 itemChoiceName = "Anime T-Shirt";
    				 choicePrice = price1;
    			 }
    	 		 else if(itemChoice.equals("55478"))
    	 		 {
    	 			 itemChoiceName = "Anime Shirt Print";
    	 			 choicePrice = price2;
    			 }
    	 		 else if(itemChoice.equals("66854"))
    	 		 {
    	 			 itemChoiceName = "Anime Notebook";
    				 choicePrice = price3;
    		 	 }
    	 		 else if(itemChoice.equals("88459"))
    	 		 {
    	 			 itemChoiceName = "Anime Figurine";
    			 	 choicePrice = price4;
    			 }
    	 		 else if(itemChoice.equals("65471"))
    	 		 {
    	 			 itemChoiceName = "Necklace";
    	 			 choicePrice = price5;
    			 }
    	 		 else if(itemChoice.equals("24751"))
    	 		 {
    	 			 itemChoiceName = "Bracelet";
    	 			 choicePrice = price6;
    			 }
    	 		 else if(itemChoice.equals("22142"))
    	 		 {
    	 			 itemChoiceName = "Ring";
    	 			 choicePrice = price7;
    			 }
     	 		 else if(itemChoice.equals("59416"))
     	 		 {
    	 			 itemChoiceName = "Anime Costume";
    	 			 choicePrice = price8;
    			 }
    	 		 else if(itemChoice.equals("45875"))
    	 		 {
    	 			 itemChoiceName = "Headphones";
    	 			 choicePrice = price9;
    			 }
    	 		 else if(itemChoice.equals("99417"))
    	 		 {
    	 			 itemChoiceName = "Cellphone Strap";
    	 			 choicePrice = price10;
    		 	 }
    			 else if(itemChoice.equals("15428"))
    	 		 {
    	 			 itemChoiceName = "Wallpaper";
    	 			 choicePrice = price11;
    		 	 }
    			 else if(itemChoice.equals("78449"))
    	 		 {
    	 			 itemChoiceName = "Costume-Make";
    	 			 choicePrice = price12;
    		 	 }
    			 else if(itemChoice.equals("45485"))
    	 		 {
    	 			 itemChoiceName = "Hairband";
    	 			 choicePrice = price13;
    		 	 }
    			 else if(itemChoice.equals("97845"))
    	 		 {
    	 			 itemChoiceName = "Anime Poster";
    	 			 choicePrice = price14;
    		 	 }
    			 else if(itemChoice.equals("15326"))
    	 		 {
    	 			 itemChoiceName = "Anime Picture";
    	 			 choicePrice = price15;
    		 	 }
    			 else if(itemChoice.equals("75984"))
    	 		 {
    	 			 itemChoiceName = "Cellphone Skin";
    	 			 choicePrice = price16;
    		 	 }
    			 else if(itemChoice.equals("66459"))
    	 		 {
    	 			 itemChoiceName = "Hat";
    	 			 choicePrice = price17;
    		 	 }
    			 else if(itemChoice.equals("96584"))
    	 		 {
    	 			 itemChoiceName = "Full Set Promo";
    	 			 choicePrice = price18;
    		 	 }
    			 else if(itemChoice.equals("74586"))
    	 		 {
    	 			 itemChoiceName = "Collage";
    	 			 choicePrice = price19;
    		 	 }
    			 else if(itemChoice.equals("74851"))
    	 		 {
    	 			 itemChoiceName = "3D Alarm Clock";
    	 			 choicePrice = price20;
    		 	 }
    
    
    	 		 BuyItem();
    	 	 }
    	 	 else if(buttonClicked == buyButton)
    	 	 {
    			 buyFrame.setVisible(false);
    			 String itemQty = buyField.getText();
    			 totalItems = Integer.parseInt(itemQty);
    			 subTotalPrice = totalItems * choicePrice;
    			 totalPrice+=subTotalPrice;
    			 receiptArea.append(itemChoiceName + times + 
    
    totalItems + equals + subTotalPrice +  newline);
    			 System.out.println(" "+ itemChoiceName + 
    
    subTotalPrice + totalPrice);
    	 	 }
    	 	 else if(buttonClicked == finalBuyButton)
    	 	 {
     			 if(itemChoice.equals("14573"))
    	 		 {
    	 			 stock1-=totalItems;
    	 			 System.out.println(" "+ stock1);
    			 }
    	 		 else if(itemChoice.equals("55478"))
    	 		 {
    	 			 stock2-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("66854"))
    	 		 {
    	 			 stock3-=totalItems;
    		 	 }
    	 		 else if(itemChoice.equals("88459"))
    	 		 {
    	 			 stock4-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("65471"))
    	 		 {
    	 			 stock5-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("24751"))
    	 		 {
    	 			 stock6-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("22142"))
    	 		 {
    	 			 stock7-=totalItems;
    			 }
     	 		 else if(itemChoice.equals("59416"))
     	 		 {
    	 			 stock8-=totalItems;;
    			 }
    	 		 else if(itemChoice.equals("45875"))
    	 		 {
    	 			 stock9-=totalItems;
    			 }
    	 		 else if(itemChoice.equals("99417"))
    	 		 {
    	 			 stock10-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("15428"))
    	 		 {
    	 			 stock11-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("78449"))
    	 		 {
    	 			 stock12-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("45485"))
    	 		 {
    	 			 stock13-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("97845"))
    	 		 {
    	 			 stock14-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("15326"))
    	 		 {
    	 			 stock15-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("75984"))
    	 		 {
    	 			 stock16-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("66459"))
    	 		 {
    	 			 stock17-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("96584"))
    	 		 {
    	 			 stock18-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("74586"))
    	 		 {
    	 			 stock19-=totalItems;
    		 	 }
    			 else if(itemChoice.equals("74851"))
    	 		 {
    	 			 stock20-=totalItems;
    		 	 }
    
    	 	 }
    
    	 		 setVisible(false);
    
    	 }//actionPerformed
    
    
    
    
    
       	 public void PerformSale()
       	 {
    	 	    saleButton.addActionListener(this);
    	 	    finalBuyButton.addActionListener(this);
    	  		salePanel.setLayout(null);
    	  		saleLabel.setFont(font3);
    	  		saleLabel.setBounds(15,5,120,30);
    	  		saleField.setBounds(140,8,50,27);
    	  		saleButton.setBounds(190,5,75,30);
    	  		receiptArea.setBounds(25,75,200,200);
    	  		mainMenuButton.setBounds(105,370,170,30);
    	  		finalBuyButton.setBounds(10,370,90,30);
    	  		salePanel.add(saleLabel);
    	  		salePanel.add(saleField);
    	  		salePanel.add(saleButton);
    	  		salePanel.add(receiptArea);
    	  		salePanel.add(finalBuyButton);
    	  		salePanel.add(mainMenuButton);
    	  		mainFrame.add(salePanel);
    			mainFrame.setSize(300,450);
    	  		mainFrame.setVisible(true);
    	  		receiptArea.setEditable(false);
    
    	 }//PerformSale
    
    
    
    
    
       	 public void InventoryList()
    	 {
    		   	String[] columnNames = {"Product", "Product Code", 
    
    "In Stock","Price"};
    
    		 	Object[][] data = {
    		            {"Anime T-Shirt","14573",stock1,price1},
    		            {"Anime Shirt Print","55478",stock2,price2},
    		            {"Anime Notebook","66854",stock3,price3},
    		            {"Anime Figurine","88459",stock4,price4},
    			    {"Necklace","65471",stock5,price5},
    		            {"Bracelet","24751",stock6,price6},
    		            {"Ring","22142",stock7,price7},
    			    {"Anime Costume","59416",stock8,price8},
    		            {"Headphones","45875",stock9,price9},
    		            {"Cellphone Strap","99417",stock10,price10},
    			    {"Wallpaper","15428",stock11,price11},
    			    {"Costume-Make","78449",stock12,price12},
    			    {"Hairband","45485",stock13,price13},
    			    {"Anime Poster","97845",stock14,price14},
    			    {"Anime Picture","15326",stock15,price15},
    			    {"Cellphone Skin","75984",stock16,price16},
    			    {"Hat","66459",stock17,price17},
    			    {"Full Set Promo","96584",stock18,price18},
    			    {"Collage","74586",stock19,price19},
    			    {"3D Alarm Clock","74851",stock20,price20}
    		            };
    
    		 	JTable table = new JTable(data,columnNames);
    
    			table.setGridColor(Color.BLACK);
    			table.setAutoCreateRowSorter(true);
    	        table.getColumnModel().getColumn(0).setPreferredWidth(110);
    		 	table.getColumnModel().getColumn
    
    (1).setPreferredWidth(110);
    		 	table.getColumnModel().getColumn
    
    (2).setPreferredWidth(110);
    	 		table.getColumnModel().getColumn
    
    (3).setPreferredWidth(110);
    	 		table.setRowHeight(25);
    	 		JScrollPane spTable = new JScrollPane(table);
    
    	 		mainFrame.add(spTable);
    			mainFrame.add(mainMenuButton,BorderLayout.PAGE_END);
    	  		mainFrame.setSize(500,420);
    	 		mainFrame.setVisible(true);
    
    	 }//InventoryList
    
    
    
    	 public void BuyItem()
    	 {
    		itemNameLabel.setText(" "+ itemChoiceName);
    		buyPanel.setLayout(null);
    		itemNameLabel.setBounds(5,2,150,20);
    		qty.setBounds(45,40,80,20);
    		buyField.setBounds(100,40,30,24);
    		buyButton.setBounds(55,70,70,30);
    		buyPanel.add(itemNameLabel);
    		buyPanel.add(qty);
    		buyPanel.add(buyField);
    		buyPanel.add(buyButton);
    		buyFrame.add(buyPanel);
    		buyFrame.setSize(190,150);
    		buyFrame.setVisible(true);
    		buyFrame.setResizable(false);
    		buyFrame.setAlwaysOnTop(true);
    	 }//BuyItem
    
    
    
    	public void QuitProgram()
    	{
    		System.out.println("\n\n\t\t\tThank you for using my 
    
    CashTill!!\n\n\t\t\t\tCome Again!!\n\n");
    	} //Quit Program the msg is shown at the prompt
    
    
    }//CashTill
    Java won't make class file-capture.png

  8. #8
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,684
    Rep Power
    5

    Default Re: Java won't make class file

    Quote Originally Posted by amelia22 View Post
    Can't someone just give me the code to it instead? I have to pass that code by 6pm and I'm not halfway through
    People don't like to help cheaters.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    amelia22 is offline Member
    Join Date
    Aug 2013
    Posts
    7
    Rep Power
    0

    Default Re: Java won't make class file

    I know right? that's why I did it myself.. and somehow I solved it myself.. sorry :)

  10. #10
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,684
    Rep Power
    5

    Default Re: Java won't make class file

    No worries, just the next time don't even give in to the urge to post such a thing, because you instantly drive people off of helping you when you do. Its in your own best interest.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Java won't make class file

    amelia22, please go through the Forum Rules, particularly the second paragraph. I've deleted the other thread you started with the same content as post #8 of this thread.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #12
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Java won't make class file

    i wasn't aware of forum rules now i have red mark under my name in this form

Similar Threads

  1. compiler telling me to make a file for a public class
    By silverglade in forum New To Java
    Replies: 10
    Last Post: 04-26-2011, 07:47 AM
  2. Can't make a java .class to a .jar
    By TheDarkMagician in forum New To Java
    Replies: 4
    Last Post: 02-19-2011, 11:45 PM
  3. How can I make this Java class work
    By ruchir123 in forum New To Java
    Replies: 2
    Last Post: 12-10-2010, 11:53 PM
  4. Use an internal Method or Make a class file?
    By TimHuey in forum New To Java
    Replies: 2
    Last Post: 09-18-2009, 03:06 PM
  5. Hints on how to make a Java Class
    By luron31 in forum New To Java
    Replies: 11
    Last Post: 07-09-2009, 05:31 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
  •