I would like to get an advise about the following question.

There is a set of text fields. The task is to generate a new JFrame and align text fields based on the information given, i.e. a row and column of each text field.

Let's say there is a text field called "Author", which has "row = 1" and "column = 2"; and also there is a text field called "Date", which has "row = 2" and "column = 1". So, now I must align text fields, e.g. "Author" must be placed in the first row and second column, etc.

I'm not sure about an approach that would be the most proper for solving this task. But it seems that some grid is required... Please, give me some advise. Thanks!

6 Years
Discussion Span
Last Post by LianaN
Featured Replies
  • 1
    Ezzaral 2,714   6 Years Ago

    [URL="http://download.oracle.com/javase/tutorial/uiswing/layout/grid.html"]GridLayout[/URL] or [URL="http://download.oracle.com/javase/tutorial/uiswing/layout/gridbag.html"]GridBagLayout[/URL] GridLayout is much simpler, but not nearly as functional as GridBagLayout. It just depends on your needs. Read More


Thanks, I suppose it could help me. I'll come back in case of any questions regarding this topic.


Well, GridBagLayout perfectly fitted my needs. Thank you once again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.