-2

enter image description here

I want to print both string and integer at once in text field.

6
  • 5
    tf3.setText(str + int1)? Commented Jan 5, 2017 at 13:26
  • In future please ensure you post code as code not as an image. Commented Jan 5, 2017 at 16:49
  • @Jinx88909 ok....but why did you blocked me from asking Commented Jan 7, 2017 at 5:50
  • @Matrix I didn't. It's the site itself that determines what you can and can't do. I think you can receive temp blocks for a variety of reasons. Not sure why in this case but all activity is monitored. Your post came up for review being a new user and I left a suggestion for future posts. I didn't even DV your post. Commented Jan 7, 2017 at 5:55
  • @Jinx88909 do you know how can i get unblock from asking question.It's been 2 days since i am blocked... Commented Jan 7, 2017 at 12:46

2 Answers 2

0

Just use string concatenation: tf3.setText(str + " " + int1);

Sign up to request clarification or add additional context in comments.

2 Comments

what about in new line i am trying Backslash character constant "\n" but its not happening tf3.setText(str +"\n "+ int1);
@Matrix use JTextArea (instead of JTextField) if you want to include "\n" in the string.
0

instead of two tf3.settext();

do

tf3.setText(str + int1)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.