1. 'SImple' 2 class Java calculator doesn't accept inputs or do calculations stackoverflow.comI'm trying to get a two class java calculator working (new to java) but so far i'm having no success. the two classes are outlined below, calcFrame is for the ... |
2. Calculator Project Problem stackoverflow.comOk I'm having a problem with this calculator. I've been assigned the project and I can only use addition and subtraction. The first part of the assignment was to create it ... |
3. Simple GUI java calculator stackoverflow.comI am building a simple GUI java calculator. I have issue finding a package or figuring out a method to do the actual calulaiton. So far i've figured that when i ... |
4. Java GUI: modifying the calculator program stackoverflow.comI'm trying to modify the calculator program our teacher gave to me. It's supposed to be composed of the main and GUI programs. My only problem is how to handle events. ... |
5. Simple java calculator stackoverflow.comI had created a basic calculator using Java Swing. The question I have is how to print each calculation on the panel. for example, I have added two numbers, my panel ... |
6. Wanted advice and comments on A Java Calculator of making code better readable, Useable or coding tips what I could Change or keep stackoverflow.comWanted advice and comments on A Java Calculator of making code better readable, Useable or coding tips what I could Change or keep. HERE IS MY MAIN CLASS
|
7. Java GUI calculator bytes.com |
8. How to add a backspace in calculator.java using swing?and remove the decimal bytes.comI'm guessing the decimals are shown in a TextField? If so, the TextField has a setText method which you are probably using already and the String class has a substring function ... |
10. My calculator needs help. coderanch.comIts better now , but you could even write the windowListener & setVisible code in the constructor, so that u need to only instantiate object of Calc class on the main method. So your Calc c = new Calc(); statement will now create components ,lay them on the frame, create listeners & display the whole frame too. Vinod |
11. Scientific Notation for Calculator coderanch.com |
12. URGENT Help With Scientific Calculator! coderanch.comHi everybody, I designed a calculator, and I need help with the rest of the actions. I know I need to use the different Math methods, but I tried that and it didn't work. Also, it needs to work as an applet and application, and in the applet, the buttons don't appear in order, how can I fix that? I will ... |
13. Calculator Problem coderanch.comHI,I made this small calculator which asks yser to enter two number and then performs the operation selected by user on clicking the button on the form.but it is giving error.The error comes when I want to write on the text field.Another error is the NullpointerException in main thread.How can i solve this problem.the code is as following: Thanks in advance ... |
14. calculator design problem coderanch.comYou divide a visual app up into MVC. M=model, V=view, and C=control. You have the "V" in the form of the keys and display, and you have part of the "C" in the form of your maths class. Now you need the "M" bit which takes the numbers from the keys, passes them to the maths class, gets the result back, ... |
15. A calculator coderanch.com |
16. GUI calculator coderanch.com |
17. Having trouble with GUI program for mortgage calculator coderanch.comMy problem is in the public static void main String[]args) /* * Calculator5GUI */ /* * @author Ruth Copenhaver */ import java.text.DecimalFormat; import javax.swing.JOptionPane; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.*; import java.util.*; import java.lang.*; import javax.swing.border.*; import java.awt.Dimension; import java.awt.Container; public class Calculator5GUI extends JFrame{ //Define variables and assign values double principle = 200000; double [] annualInterest = {5.35, ... |
18. Mortgage Calculator and GUI coderanch.comHello All, I have to design a GUI interface for a Mortgage calculator and for the life of me I can't seem to fit my limited knowledge of GUI-ness with the source code for the calculator. Basically I want to make a GUI for the below source code. I know I want to put the output in a JTextArea with a ... |
19. GUI Mortgage Calculator coderanch.comI'm having the hardest time trying to figure out how to have my code calculate and display. The GUI portion is finally done, now I need help with the calculations. The current formula is a borrowed one from a web site I was looking through for answers to this question, I think this may be my problem. My original formula is ... |
20. Please need help with calculator program... coderanch.comHi guys, I please need your help with this small project that I need to do for an assignment. (I'm a correspondent student so I am allowed help from outside as long as I understand it when the exams come.) I have attached a .doc file for you to see what the project specifations are as well as the output of ... |
21. advanced calculator coderanch.com[color=red] [size=12] my problem starts here if(s.equals("MC")) { try { m1=0; jtx.setText(""); } catch(Exception ee) { System.out.println("Error:"+ee); } } if(s.equals("MR")) { try { //jtx.setText(""); jtx.setText(jtx.getText() ); } catch(Exception me) { System.out.println("Error:"+me); } } if(s.equals("M+")) { if(k==1) { m1=Double.parseDouble(jtx.getText()); k++; } else { m1+=Double.parseDouble(jtx.getText()); jtx.setText(""+m1); } } if(s.equals("M-")) { if(k==1) { m1=Double.parseDouble(jtx.getText()); k++; } else { m1-=Double.parseDouble(jtx.getText()); jtx.setText(""+m1); } } [/color] [/size] ... |
22. I'm stuck with calculator GUI coderanch.com1/ use a main vbox or VBOxLayout, then a gridbaglayout for the buttons (with an vertical and horizontal spacing) 2/ unless this is a teaching lesson (in witch case by hand is much better), otherwise use a visual builder, you'll have found all your answers in a matter of hours. Such a layout takes 10 minutes with a visual builder. |
23. Java scientific calculator (reposted) coderanch.comimport java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; public class ScientificCalculator extends JFrame implements ActionListener { JTextField tfield; double temp, temp1, result, a; static double m1, m2; int k = 1, x = 0, y = 0, z = 0; char ch; JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, zero, plus, min, div, mul, eq, clr; Container cont; ... |
24. What am I doing wrong in this swing Java calculator coderanch.com// The "SharifCulminating" class. import java.awt.*; import javax.swing.*; // for GUI components import java.awt.event.*; // for actions to be registered import java.awt.FlowLayout; import java.io.*; // For file input and output import java.text.*; // For DecimalFormat and NumberFormat import java.util.*; public class SharifCulminating { public static void main (String[] args) { new SharifCulminating ("Calculator"); } // main method } class SharifCulminating extends ... |
25. stupid "E" in calculator java-forums.orgstupid "E" in calculator if i square 8, and get 64, then square that and get 4096, i then square 4096, and get "1.6777216E7" why is the E there already? is there any way to make it so that it does appear that soon, like on the windows calculator, with the windows calculator i have to press the x2 ... |
26. Calculator java-forums.orgi have just designed GUI,but i have got a problem in solving events. XML Code: import java.text.DecimalFormat; import java.awt.*; import javax.swing.*; import java.awt.event.*; class Caculator implements ActionListener{ double currentTotal = 0.0; DecimalFormat df = new DecimalFormat("0.00"); boolean totalDisplayed = true; JFrame f; JTextField t1; JLabel l1; JPanel p2 ; JButton b1; JButton b2; JButton b3; JButton b4; JButton b5; JButton b6; ... |
27. need help with my calculator java-forums.orgthe other calculator buttons work. i wrote the method below to handle numbers 1,2,3... but it doesn't work for the backspace button.i need it to work the same way a keyboard backspace works. public void assign(String n) { if((textField.getText()).equals("0")) textField.setText(n); else{ n = textField.getText()+""+n; textField.setText(n); } } so for number 1, i just call assign("1"); an so on. |
28. Help with AWT CALCULATOR java-forums.orgMy codes ADD SUBTRACT MULTIPLY and DIVIDE sometimes work and sometimes don't. I can't identify what's wrong with my code. Can somebody help me please? Java Code: import java.io.*; import java.lang.Math.*; import java.awt.*; import java.awt.event.*; import java.awt.Component.*; public class SuperCalcu extends Frame implements ActionListener, WindowListener /* IGUAL * PUNTO * DECIMAL * C * MATH */ { //0 Label //1 ventana ... |
29. Volume Calculator Problem java-forums.orgHello all! I am having a problem with a calculator that calculates the volume of a pool based on user input. Our program runs (its a group program) but our calculate button always gives us this error:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at FinalProject$calcBtnHandler.actionPerformed(FinalP roject.java:136) at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source) at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseRe ... |
30. calculator java-forums.orgimport javax.swing.*; import java.awt.*; import java.awt.event.*; class calculator extends JFrame { JPanel p1=new JPanel(); JTextField t1=new JTextField(); JTextField t2=new JTextField(); JTextField t3=new JTextField(); JButton b1=new JButton("+"); public calculator() { p1.add(t1); p1.add(t2); p1.add(t3); p1.add(b1); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { String value=t1.getText(); String value1=t2.getText(); t3.setText()=value+value1; } }); } public static void main(String args[]) { calculator frame=new calculator(); } } |
31. Helo with calculator GUI and code java-forums.orgSince it's a public method you probably don't even need to call super, it should inherit the method, you will need to probably call super.getTotal or you may be able to directly manipulate total, not sure entirely how that works with inheritance and private instance variables. You can also make the instance variables protected of you want to do direct manipulation. ... |
32. GUI calculator resetting variables problem forums.oracle.comI might be confusing you with someone else, but if memory serves, you are making a habit out of putting up 10 duke stars with every subject, and then instead of awarding them, you withdraw them even though you were answered. You do go back and say "thank you" though. But if you're withdrawing the dukes (even though they really aren't ... |
33. BMI calculator/GUI forums.oracle.comI'd also recommend that you separate the BMI calculation from the UI. You don't need a Swing UI to perform such a calculation. Move that bit into a Java class that you can test offline without the UI. You'll have the added benefit of being able to use a web UI, deploy as a service, etc. % |
34. Help with GUI Calculator forums.oracle.com |
35. Help with Calculator GUI program please [SOLVED] forums.oracle.compublic class Calc extends JFrame implements ActionListener { JPanel keypad = new JPanel(new GridLayout(4,4,2,2)); Font font = new Font("SansSerif", Font.BOLD, 32); JButton keys[][]; JTextField display = new JTextField("0"); String calc; double accum; int op; boolean newsum = true; final int PLUS = 1; final int MINUS = 2; final int TIMES = 3; final int DIVIDE = 4; |
36. Scope and Objectives of making java swing scientific calculator forums.oracle.comIf this is for school work, then defining the scope is part of the problem. The only advice I will give you is that you only need to implement what the assignment specifies. It is probably intentionally vague so you can bite off way too much and not finish -- failure should teach you something too. I had just such an ... |
37. Help please- GUI calculator forums.oracle.comwhile (operator == "+") { answer = operand1 + operand2; } while (operator == "-") { answer = operand1 - operand2; } while (operator == "*") { answer = operand1 * operand2; } while (operator == "/") { if (operand2 == 0) JOptionPane.showInputDialog("Division by 0 not allowed!"); else answer = operand1 / operand2; } while (operator == "^") { answer = ... |
38. Seconds calculator GUI forums.oracle.comError messages contain helpful information to help you diagnose and solve problems. Don't think of error message as the compiler scolding you. That's a common newbie mistake. Look upon them as the compiler helping you fix what's broken. Read the error messages. If you don't understand them enough to use them to fix your problem, then post them here and ask ... |
39. GUI calculator forums.oracle.comhi i'm developing a GUI calculator similar to windows calculator using Netbeans.Though i've written the program and created the user interface the problem i'm facing is that how can i take the text which is being entered in the text field as my input for the program.As i'm new to java it will b kind of u to let me know ... |
40. Calculator in Swing forums.oracle.com |
41. help on GUI calculator forums.oracle.com/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // |