Child pages
  • InputLayout
Skip to end of metadata
Go to start of metadata

The layout manager that handles columns; each column contains two subcolumns, one is the "prompt" and the other is the "input". I wrote it long ago; feel free to use it. Just add it to your favorite package.

First, here's how to use it when you want only one column. Note that the getter methods return a JTextField. As you see, when you add components, the order is very important. The odd components are the labels (prompts), and the even components are the input fields. Odd in this sense is the serial number of the add call.

Well, actually it's not that simple. When laying out the components, the manager queries the target component (the pane) for the subcomponents, and uses the order they are provided. That's important only if you change the order of the subcomponents later. It might even cause the reordering of the components on the already displayed pane.

Sample code of using the layout manager.

And the source code of the layout manager (and here you are the downloadable source code):

Source code
      
      
Page viewed 125 times by 2 users since Jan 27, 2014
  • No labels