i have a problem i.e i want to add new line after the second text field; let say i have made one text field and for the second text field i want that it will come in the next row, now how i displayed it in the second row?? thnx

Recommended Answers

All 2 Replies

You asked this (and I answered it) in your previous post:

An easy way is to create it when you build the window at the start, but make it invisible (setVisible(false)). Then when you want it to appear make it visible and pack() your window again.

If you use FlowLayout and the container is wide enough, both text fields will appear in the same row. You either need to make your container more narrow so the next text field will appear in the next row, or use a different layout manager. Probably GridLayout would be the easiest.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.