< // The line numbers did change when I pasted, listed as compiled. I apologize in advance I did mark 295:no suitable method // // Primary Goal=Remaining Compile Errors Resolved--> I had 51 before and worked through and made corrections, mostly misspells, forgetting capitals // // and Color scheme not liking (new Color(blue)) but rather (new Color(0,0,255)) to not issue an error. Whew-Progress!// // I'm down to 11 at lines: 148, 149, 150, 295, 325, 335, 339, 343. 347, 351, 355.// // All are "error:cannot find symbol" except 295= error: no suitable method found for showMessageDialog(PizzaOrderingProgramPanel,String,int) which I think is creating the other errors // // See Below message at line #306 for more info. Any advice or help is greatly appreciated // //*******************************************************// // Pizza Project Authors: Chuck Armstrong, Nick Gesick. // // // //--------------Pizza Ordering Program-------------------// import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.text.*; import java.applet.*; public class PizzaOrderingProgramPanel extends Applet implements ActionListener, KeyListener { //---Pizza Options Pricing---// private final doublesmallSizePrice = 5.00, mediumSizePrice = 10.00, largeSizePrice = 15.00, thinTypePrice = 0.00, thickTypePrice = 0.00, panTypePrice = 1.50, anchoviesToppingPrice = 1.00, canadian_baconToppingPrice = 1.00, salamiToppingPrice = 1.00, pepperoniToppingPrice = 1.00, sausageToppingPrice = 1.00, mushroomToppingPrice = 1.00, oliveToppingPrice = 1.00, onionToppingPrice = 1.00, green_pepperToppingPrice = 1.00; //pizzaJTextFieldPrice = 1.00;---commented out for now, may discard, may use// //-------GUI Setup-------// Panel northPanel, northSizePanel, westPanel, westTypePanel, centerPanel, centerToppingPanel, eastPanel, eastPizzaJTextFieldPanel, southPanel, southPricePanel; Label titleLabel, sizeLabel, typeLabel, textFieldLabel, amountLabel, toppingLabel, inputLabel, outputLabel, resultsLabel, priceLabel, priceDisplayLabel; Button orderButton; JTextField pizzaJTextField, priceJTextField; ButtonGroup sizeBGroup, typeCGroup; JRadioButton smallJRadioButton, mediumJRadioButton, largeJRadioButton, thinJRadioButton, thickJRadioButton, panJRadioButton; JCheckBox anchoviesJCheckBox, canadian_baconJCheckBox, salamiJCheckBox, pepperoniJCheckBox, sausageJCheckBox, mushroomJCheckBox, oliveJCheckBox, onionJCheckBox, green_pepperJCheckBox; //---------------------------------------------------------------------// // Setup Panels with Radio Buttons, Checkboxes, & Text Field // //--------------------------------------------------------------------// public void init() { setBackground(new Color(0,255,0)); setLayout(new BorderLayout(0,0)); northPanel = new Panel(); northPanel.setBackground(new Color(0,255,0)); northPanel.setLayout(new FlowLayout()); northSizePanel = new Panel(); northSizePanel.setBackground(new Color(0,255,0)); northSizePanel.setLayout(new FlowLayout()); westPanel = new Panel(); westPanel.setBackground(new Color(0,255,0)); westPanel.setLayout(new FlowLayout()); westTypePanel = new Panel(); westTypePanel.setBackground(new Color(0,255,0)); westTypePanel.setLayout(new FlowLayout()); centerPanel = new Panel(); centerPanel.setBackground(new Color(0,255,0)); centerPanel.setLayout(new FlowLayout()); centerToppingPanel = new Panel(); centerToppingPanel.setBackground(new Color(0,255,0)); centerToppingPanel.setLayout(new GridLayout(2,3,0,0)); eastPanel = new Panel(); eastPanel.setBackground(new Color(0,255,0)); eastPanel.setLayout(new FlowLayout()); eastPizzaJTextFieldPanel = new Panel(); eastPizzaJTextFieldPanel.setBackground(new Color(0,255,0)); southPanel = new Panel(); southPanel.setBackground(new Color(0,255,0)); southPanel.setLayout(new FlowLayout()); southPricePanel = new Panel(); southPricePanel.setBackground(new Color(0,255,0)); southPricePanel.setLayout(new FlowLayout()); //---Setup Labels---// titleLabel = new Label("Hedwig's Owl Delivery Pizza"); titleLabel.setBackground(new Color(0,0,255)); titleLabel.setForeground(new Color(255,255,255)); titleLabel.setFont(new Font("Tahoma",Font.BOLD,40)); sizeLabel = new Label("Select a size for your custom-made pizza:"); sizeLabel.setForeground(new Color(255,0,0)); typeLabel.setFont(new Font("Tahoma",Font.BOLD,12)); typeLabel = new Label("Select a crust type for your custom-made pizza:"); typeLabel.setForeground(new Color(255,0,0)); typeLabel.setFont(new Font("Tahoma",Font.BOLD,12)); toppingLabel = new Label("Select one or more choices of the toppings below : "); toppingLabel.setForeground(new Color(255,0,0)); toppingLabel.setFont(new Font("Tahoma",Font.BOLD,12)); pizzaJTextFieldLabel = new Label("Type in non-listed pizza topping:"); pizzaJTextFieldLabel.setForeground(new Color(255,0,0)); pizzaJTextFieldLabel.SetFont (new Font("Tahoma",Font.BOLD,12)); amountLabel = new Label("Amount: "); amountLabel.setForeground(new Color(0,0,0)); amountLabel.setFont(new Font("Tahoma",Font.BOLD,12)); priceLabel = new Label("Total price of your order : "); priceLabel.setForeground(new Color(255,0,0)); priceLabel.setFont(new Font("Tahoma",Font.BOLD,12)); priceDisplayLabel = new Label("$0.00 "); priceDisplayLabel.setForeground(new Color(255,0,0)); priceDisplayLabel.setFont(new Font("Tahoma",Font.BOLD,30)); //---Ordering Button---// orderButton = new Button("Order Now"); orderButton.setFont(new Font("Tahoma",Font.BOLD,14)); //---Radio Buttons---// smallJRadioButton = new JRadioButton("Small", false); mediumJRadioButton = new JRadioButton("Medium", true); largeJRadioButton = new JRadioButton("Large", false); thinJRadioButton = new JRadioButton("Thin", false); thickJRadioButton = new JRadioButton("Thick", true); panJRadioButton = new JRadioButton("Pan", false); sizeBGroup = new ButtonGroup(); sizeBGroup.add(smallJRadioButton); sizeBGroup.add(mediumJRadioButton); sizeBGroup.add(largeJRadioButton); typeCGroup = new ButtonGroup(); typeCGroup.add(thinJRadioButton); typeCGroup.add(thickJRadioButton); typeCGroup.add(panJRadioButton); //---CheckBoxes---// anchoviesJCheckBox = new JCheckBox("Anchovies",false); canadian_baconJCheckBox = new JCheckBox("Canadian Bacon",false); salamiJCheckBox = new JCheckBox("Salami",false); pepperoniJCheckBox = new JCheckBox("Pepperoni",false); sausageJCheckBox = new JCheckBox("Sausage",false); mushroomJCheckBox = new JCheckBox("Mushroom",false); oliveJCheckBox = new JCheckBox("Olive",false); onionJCheckBox = new JCheckBox("Onion",false); green_pepperJCheckBox = new JCheckBox("Green Pepper",false); //---TextField---// pizzaJTextField = new JTextField("0",1); pizzaJTextField.setFont(new Font("Tahoma",Font.BOLD,12)); //---Setup Listeners---// orderButton.addActionListener(this); smallJRadioButton.addActionListener(this); mediumJRadioButton.addActionListener(this); largeJRadioButton.addActionListener(this); thinJRadioButton.addActionListener(this); thickJRadioButton.addActionListener(this); panJRadioButton.addActionListener(this); anchoviesJCheckBox.addActionListener(this); canadian_baconJCheckBox.addActionListener(this); salamiJCheckBox.addActionListener(this); pepperoniJCheckBox.addActionListener(this); sausageJCheckBox.addActionListener(this); mushroomJCheckBox.addActionListener(this); oliveJCheckBox.addActionListener(this); onionJCheckBox.addActionListener(this); green_pepperJCheckBox.addActionListener(this); pizzaJTextField.addKeyListener(this); } //---Nesting Components to Panels---// public void start() { northPanel.add(sizeLabel); northSizePanel.add(smallJRadioButton); northSizePanel.add(mediumJRadioButton); northSizePanel.add(largeJRadioButton); westTypePanel.add(typeLabel); westTypePanel.add(thinJRadioButton); westTypePanel.add(thickJRadioButton); westTypePanel.add(panJRadioButton); centerPanel.add(toppingLabel); centerToppingPanel.add(anchoviesJCheckBox); centerToppingPanel.add(canadian_baconJCheckBox); centerToppingPanel.add(salamiJCheckBox); centerToppingPanel.add(sausageJCheckBox); centerToppingPanel.add(mushroomJCheckBox); centerToppingPanel.add(oliveJCheckBox); centerToppingPanel.add(onionJCheckBox); centerToppingPanel.add(green_pepperJCheckBox); eastPizzaJTextFieldPanel.add(inputLabel); eastPizzaJTextFieldPanel.add(outputLabel); eastPizzaJTextFieldPanel.add(resultsLabel); southPanel.add(southPricePanel); southPricePanel.add(amountLabel); southPricePanel.add(priceLabel); southPricePanel.add(priceDisplayLabel); southPricePanel.add(orderButton); //---Setup Panels to Border---// add(northPanel, BorderLayout.NORTH); add(westPanel, BorderLayout.WEST); add(centerPanel, BorderLayout.CENTER); add(eastPanel, BorderLayout.EAST); add(southPanel, BorderLayout.SOUTH); pizzaJTextField.selectAll(); } public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { //---If no text entered---// try { Integer.parseInt(pizzaJTextField.getText()); } catch (NumberFormatException fe) { pizzaJTextField.setText("1"); } refreshPrice(); } //---Order Button Action---// public void actionPerformed(ActionEvent e) { if (e.getSource() == orderButton) { JOptionPane.showMessageDialog(this,//LINE#295 IS HERE// "Thank's for your " + priceDisplayLabel.getText() + " payment." + "\n\nYour custom pizza will be delivered to you shortly via owl!" + "\nThank You for your Business! Happy Holidays!", JOptionPane.INFORMATION_MESSAGE); } refreshPrice(); } //---Text String Converted to Value---// //#306--->Secondary Goal: Text string converted to value of 1.00//This is area of faulty method See #295 above// //!!!!!!!I believe it needs work around this area(up a bit and/or down a bit)!!!!!!!// // I need to change the code so it can work with any input text not just String text that can be parsed to an Int!!!AAaaarrrgg!!!// //--->Tried String.parseString(pizzaJTextField.getText()); and .setText("1") to set any input to 1.00, but that didn't work either// // No one seems to have an answer, I keep ending up with searches that show simple String.toInt or String.parseInt examples// //that tend to choke on non-number text. Can "Ten" be set to 10 or any number like 1 if I want? I hope so.// // Maybe if I made an exception that has any input text but blank add $1.00: which is the desired outcome// // We do not care what the user entered whether its"extra cheese" in the text field or the "kitchen sink"// // as long as any text entry is set to a value of 1.00 and it is added with all the other options,// // or if a blank entry we set to a value of 0.00 and still add all other options,// // PROBLEM IS: seems if done this way any number entered except "0" or "1" will add too much->Example// //(5 will add 5.00 to the other options) GOAL: All text input should set a value of $1.00 // // or if left blank set to a value of $0.00 which is one of the goals of the TextField input per the project scenario as assigned. // // I have more attempted ideas below but am kinda stuck here especially with this method not working to do what I want// // Ideas=--> String.(pizzaJTextField.setText("1")); In the try-catch statement above or creating a couple new if statements// // to match a filled TextField or blank TextField // // or pizzapizzaJTextField.setValue(new Double(1.00)); -OR- ?????????????? // //My searches keep getting me similar results. I need fresh eyes & ideas, Thanks // private void refreshPrice() { double price = 0; int pizzaAmount = Integer.parseInt(pizzaJTextField.getText()); NumberFormat numberform = NumberFormat.getNumberInstance(); DecimalFormat moneyForm = (DecimalFormat)numberForm; moneyForm.applyPattern("0.00"); //*******If Statements*******// //---Radio Buttons Priced---// if (smallJRadioButton.isSelected()) { price+= smallPizzaPrice * pizzaAmount; } if (mediumJRadioButton.isSelected()) { price+= mediumPizzaPrice * pizzaAmount; } if (largeJRadioButton.isSelected()) { price+= largePizzaPrice * pizzaAmount; } if (thinJRadioButton.isSelected()) { price+= thinPizzaPrice * pizzaAmount; } if (thickJRadioButton.isSelected()) { price+= thickPizzaPrice * pizzaAmount; } if (panJRadioButton.isSelected()) { price+= panPizzaPrice * pizzaAmount; } //---CheckBoxes priced---// if (anchoviesJCheckBox.isSelected()) { price+= anchoviesToppingPrice * pizzaAmount; } if (canadian_baconJCheckBox.isSelected()) { price+= canadian_baconToppingPrice * pizzaAmount; } if (salamiJCheckBox.isSelected()) { price+= salamiToppingPrice * pizzaAmount; } if (pepperoniJCheckBox.isSelected()) { price+= pepperoniToppingPrice * pizzaAmount; } if (sausageJCheckBox.isSelected()) { price+= sausageToppingPrice * pizzaAmount; } if (mushroomJCheckBox.isSelected()) { price+= mushroomToppingPrice * pizzaAmount; } if (oliveJCheckBox.isSelected()) { price+= oliveToppingPrice * pizzaAmount; } if (onionJCheckBox.isSelected()) { price+= onionToppingPrice * pizzaAmount; } if (green_pepperJCheckBox.isSelected()) { price+= green_pepperToppingPrice * pizzaAmount; } priceDisplayLabel.setText("$"+moneyForm.format(price)); } } >