Results 1 to 3 of 3
Thread: [SOLVED] Textfield
- 07-10-2008, 05:30 PM #1
Member
- Join Date
- Jul 2008
- Posts
- 14
- Rep Power
- 0
[SOLVED] Textfield
Hi, just a quick question on something that is buggin me (and i have searched google and the forums but cant find anything).
I am creating a calculator in netbeans, i have used the GUI part to create the design and i am currently writing the code for the buttons. My issue is that i cant remember nor find the code to add characters to a textfield without deleting what is already in there.
If someone can give me the code or direct me to a place where i could find it i would be most appreciative :)
Fireking
- 07-10-2008, 08:26 PM #2
One way would be to get what's there now, concat the new values to it and put it back. Read the API doc for the correct methods.
- 07-11-2008, 03:40 AM #3
Member
- Join Date
- Jul 2008
- Posts
- 14
- Rep Power
- 0
thx after a good 10 mins that seems to work :)
Didn't know you could do that :)
the code i have for each button is as follows
Java Code:private void btnOneActionPerformed(java.awt.event.ActionEvent evt) { // if/else statement to allow me to join the numbers without adding them 'concatenate' if (screenNo == 0) { txtScreen.setText("1"); screenNo = 1; } else concatNo = txtScreen.getText().concat("1"); screenNo = Float.parseFloat(concatNo); txtScreen.setText(concatNo); }
Similar Threads
-
set focus to the textfield
By paty in forum New To JavaReplies: 2Last Post: 07-09-2010, 08:28 AM -
textfield and database
By t3mh4 in forum JDBCReplies: 2Last Post: 05-14-2008, 08:12 AM -
JSP - getting value from a textfield
By Java Tip in forum Java TipReplies: 0Last Post: 12-01-2007, 08:58 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks