How to make textbox in swing in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to make textbox in swing in java?

23rd Apr 2017, 1:08 AM
Dhirendra rathore
Dhirendra rathore - avatar
4 Answers
+ 8
JTextField m=new JTextField("Initial text"); Then add to panel, x.add(m); x is panel name.Also if you want to resize these things you gotta use gridBagConstraint and gridBagLayout, google those. To set width of textbox:- m.setColoumns(10);
23rd Apr 2017, 1:13 AM
Meharban Singh
Meharban Singh - avatar
+ 6
There are A LOT more things, difficult to write,I recommend google those.
23rd Apr 2017, 1:13 AM
Meharban Singh
Meharban Singh - avatar
+ 5
Or JTextArea the easiest textbox
23rd Apr 2017, 1:30 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 3
GZB.....Bhai
23rd Apr 2017, 1:48 AM
Vinay
Vinay - avatar