Please I Need Help On This Task on java - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Please I Need Help On This Task on java (774 Views)
| Please I Need Help On This Task on java by xtianh(op): 10:27am On Nov 07, 2013 |
I am developing a gp calculator. How can i assign a value to selected item on the jcombobox. For example i created a jcombobox, and added A,B,C to it as its item, i want if A is selected let A be equals to 5 and multiplied by 2 and the result be pasted in a Jtextfield. just like A = 5*2 and the result be pasted to a textfield. I will be waiting for your reply please kindly help me out. please don't mind my expression |
| Re: Please I Need Help On This Task on java by codeaddict(m): 10:42am On Nov 07, 2013 |
What exactly do you want answers to? How to assign values based on a selected item? Or how to append text to a JTextField? |
| Re: Please I Need Help On This Task on java by chykmoni(m): 10:55am On Nov 07, 2013 |
Visit W3Cschool.com |
| Re: Please I Need Help On This Task on java by xtianh(op): 12:32pm On Nov 07, 2013 |
codeaddict: What exactly do you want answers to?how to assign values to a selected item. like if the items are A,B,C. when the user selects A, i want A = 5 * 2; then the result which is 10 be displayed on a jtextfield |
| Re: Please I Need Help On This Task on java by jboy01(m): 12:40pm On Nov 07, 2013 |
xtianh: I am developing a gp calculator. How can i assign a value to selected item on the jcombobox. For example i created a jcombobox, and added A,B,C to it as its item, i want if A is selected let A be equals to 5 and multiplied by 2 and the result be pasted in a Jtextfield.create an event listener for the combox box, and if u are using an ide, in the itemStateChanged event, put Switch (gradeComboBox.getSelectedIndex()){ Case 0: JTextBoxResult.setText(String.valueOf(5 x 2)); break; Case 1: JTextBoxResult.setText(String.valueOf(4 x 2)); break; Case 2: JTextBoxResult.setText(String.valueOf(3 x 2)); break; Case 3: JTextBoxResult.setText(String.valueOf(2 x 2)); break; Case 4: JTextBoxResult.setText(String.valueOf(1 x 2)); break; } |
| Re: Please I Need Help On This Task on java by codeaddict(m): 1:56pm On Nov 07, 2013 |
xtianh: how to assign values to a selected item. like if the items are A,B,C. when the user selects A, i want A = 5 * 2;Something similar to this:
Replace with DReplace with ) |
| Re: Please I Need Help On This Task on java by xtianh(op): 8:43am On Nov 08, 2013 |
thanks to u guys. I will be posting my area of difficulty here please i would like you to always visit and render a helping hand |
| Re: Please I Need Help On This Task on java by dsypha(m): 11:03pm On Nov 09, 2013 |
chykmoni: Visit W3Cschool.comNot sure how u think or reason, But i thought u should remind you that commentin is not by force, W3schools for java? na wa oo |
Programming Competition: Search Engine Task. Rewards up for grabs. • Programmers How Would You Approach This Task? • Help On Java • 2 • 3 • 4
Top 400 Python Projects With Source Code. Learn About Them, Make Yours & Sell • Python The Myth • Pls Programmers And Web Developers Help Out
", "E"};
;