Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TextField question

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
0
0
US
I have a Frame that does NOT use a layoutManager. I want to manually control the position of each component in my Frame. To set my TextField's position, I use this line:

myTextField.setLocation(400,100);

However, myTextField always appears at coordinates 0,0. How can I correct this?
 
Frames use by default the BorderLayout. To use absolute positioning, you'd have to remove that default by settimg the layout to null.

JFrame frame = new JFrame("No layout test");
frame.setLayout(null);
 
Thanks alot!

this.setLayout(null);

stopped the behavior
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top