Example
#{example}"); ipb.editor_values.get('templates')['togglesource'] = new Template(""); ipb.editor_values.get('templates')['toolbar'] = new Template(""); ipb.editor_values.get('templates')['button'] = new Template("
Emoticons
"); // Add smilies into the mix ipb.editor_values.set( 'show_emoticon_link', false ); ipb.editor_values.set( 'bbcodes', $H({"snapback":{"id":"1","title":"Post Snap Back","desc":"This tag displays a little linked image which links back to a post - used when quoting posts from the board. Opens in same window by default.","tag":"snapback","useoption":"0","example":"[snapback]100[/snapback]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"topic":{"id":"5","title":"Topic Link","desc":"This tag provides an easy way to link to a topic","tag":"topic","useoption":"1","example":"[topic=1]Click me![/topic]","switch_option":"0","menu_option_text":"Enter the topic ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"post":{"id":"6","title":"Post Link","desc":"This tag provides an easy way to link to a post.","tag":"post","useoption":"1","example":"[post=1]Click me![/post]","switch_option":"0","menu_option_text":"Enter the Post ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"spoiler":{"id":"7","title":"Spoiler","desc":"Spoiler tag","tag":"spoiler","useoption":"0","example":"[spoiler]Some hidden text[/spoiler]","switch_option":"0","menu_option_text":"","menu_content_text":"Enter the text to be masked","single_tag":"0","optional_option":"0","image":""},"acronym":{"id":"8","title":"Acronym","desc":"Allows you to make an acronym that will display a description when moused over","tag":"acronym","useoption":"1","example":"[acronym='Laugh Out Loud']lol[/acronym]","switch_option":"0","menu_option_text":"Enter the description for this acronym (EG: Laugh Out Loud)","menu_content_text":"Enter the acronym (EG: lol)","single_tag":"0","optional_option":"0","image":""},"hr":{"id":"12","title":"Horizontal Rule","desc":"Adds a horizontal rule to separate text","tag":"hr","useoption":"0","example":"[hr]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"1","optional_option":"0","image":""},"php":{"id":"14","title":"PHP Code","desc":"Allows you to enter PHP code into a formatted/highlighted syntax box","tag":"php","useoption":"0","example":"[php]$variable = true;\n\nprint_r($variable);[/php]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"html":{"id":"15","title":"HTML Code","desc":"Allows you to enter formatted/syntax-highlighted HTML code","tag":"html","useoption":"0","example":"[html]\n \n[/html]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"sql":{"id":"16","title":"SQL Code","desc":"Allows you to enter formatted/syntax-highlighted SQL code","tag":"sql","useoption":"0","example":"[sql]SELECT p.*, t.* FROM posts p LEFT JOIN topics t ON t.tid=p.topic_id WHERE t.tid=7[/sql]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"xml":{"id":"17","title":"XML Code","desc":"Allows you to enter formatted/syntax-highlighted XML code","tag":"xml","useoption":"0","example":"[xml]1 Replies - 32 Views - Last Post: Yesterday, 09:52 PM
#1
Reputation: 0
- Posts: 3
- Joined: 20-March 13
Posted Yesterday, 09:31 PM
Hey there everyone, I have this task for Java where I must create a GUI for calculating the area/volume of a circle. Our instructor gave us the hints//reminders and we are supposed to fill in the actual code. Here Is the code for GUI that I have so far:import javax.swing.*; import java.awt.*; import java.awt.event.*; public class CircleTestGUI extends JFrame implements ActionListener { // declare GUI components JLabel lblRadiusInput; JTextField txtRadiusInput; JLabel lblEchoInput; JTextField txtEchoInput; JLabel lblAreaOutput; JTextField txtAreaOutput; JLabel lblCircumferenceOutput; JTextField txtCircumferenceOutput; JLabel lblClickToCompute; JButton compute; JPanel panInterface; JPanel panGUI; // declare two global instance variables related to inputs boolean validInput; double radiusInput = 0.0; public void init( ) { JPanel panInterface = new JPanel( ); panInterface.setLayout( new GridLayout(1, 1) ); panInterface = createGUI( ); setContentPane(panInterface); } public void actionPerformed(ActionEvent userClick) { // call method to obtain and validate input // perform computations only if method returns true if (validateInput( )) { if (userClick.getSource( ) == compute) { // instantiate an object of type Circle // with the valid radius inputted by the user Circle One = new Circle (radiusInput); // echo back the input to the user txtEchoInput.setText(Double.toString(One.getRadius( ))); // call the method to compute the area // convert the numeric answer to a string with four places after the decimal point // set the text in the appropriate JTextField txtAreaOutput.setText(One.toPrecisionFourString(One.computeArea(One))); // call the method to compute the circumference // convert the numeric answer to a string with four places after the decimal point // set the text in the appropriate JTextField txtCircumferenceOutput.setText(One.toPrecisionFourString(One.computeVolume(One))); // a finalizer to free up memory allocation on Circle One One = null; } } } public JPanel createGUI( ) { JPanel panGUI = new JPanel( ); panGUI.setLayout( new GridLayout(5, 2, 5, 5) ); // developing input row lblRadiusInput = new JLabel("Please input the radius: ", SwingConstants.RIGHT); panGUI.add(lblRadiusInput); txtRadiusInput = new JTextField(6); panGUI.add(txtRadiusInput); // developing command button row for program execution lblClickToCompute = new JLabel("Click button to solve: ", SwingConstants.RIGHT); panGUI.add(lblClickToCompute); compute = new JButton("Compute"); compute.addActionListener(this); panGUI.add(compute); // developing output row for echo of the input lblEchoInput = new JLabel("Echoing your input: ", SwingConstants.RIGHT); panGUI.add(lblEchoInput); txtEchoInput = new JTextField(5); txtEchoInput.setEditable(false); panGUI.add(txtEchoInput); // developing output row for area lblAreaOutput = new JLabel("The area of the circle: ", SwingConstants.RIGHT); panGUI.add(lblAreaOutput); txtAreaOutput = new JTextField(15); txtAreaOutput.setEditable(false); panGUI.add(txtAreaOutput); // developing output row for circumference lblCircumferenceOutput = new JLabel("The circumference of the circle: ", SwingConstants.RIGHT); panGUI.add(lblCircumferenceOutput); txtCircumferenceOutput = new JTextField(15); txtCircumferenceOutput.setEditable(false); panGUI.add(txtCircumferenceOutput); return panGUI; } public boolean validateInput( ) { validInput = true; try { radiusInput = Double.parseDouble(txtRadiusInput.getText( )); } catch (NumberFormatException nfeDouble) { // give error message when input can't be parsed to double JOptionPane.showMessageDialog(null, "You need to enter a number", "Input Error", JOptionPane.ERROR_MESSAGE); // set boolean variable to false when // received an invalid input validInput = false; // blanking out inputs and any previous outputs // when input is invalid txtRadiusInput.setText(""); txtEchoInput.setText(""); txtAreaOutput.setText(""); txtCircumferenceOutput.setText(""); } return validInput; } }
When I compile and run the code, I get the following errors:
----jGRASP exec: javac -g CircleTestGUI.java CircleTestGUI.java:53: error: cannot find symbol Circle One = new Circle (radiusInput); ^ symbol: class Circle location: class CircleTestGUI CircleTestGUI.java:53: error: cannot find symbol Circle One = new Circle (radiusInput); ^ symbol: class Circle location: class CircleTestGUI 2 errors ----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete.
My mind is drawing a blank and I haven't been able to fix the error. Any input on how I could fix it?
Is This A Good Question/Topic? 0
Replies To: Error: cannot find symbol, problem with GUI for area/volume of circle
#2
Reputation: 10
- Posts: 50
- Joined: 12-May 09
Re: Error: cannot find symbol, problem with GUI for area/volume of circle
Posted Yesterday, 09:52 PM
first you dont have a class Circle i think you mean CircleTestGUI on line 51 also you are calling for a radius but you dont have a constructor that needs radius
Page 1 of 1
andy pettitte tyler clementi kevin kolb sarah shahi rutgers dharun ravi george clooney arrested
No comments:
Post a Comment