Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7754445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:18:35+00:00 2026-06-01T12:18:35+00:00

We have a panel which displays a form with an arbitrary number of JTextFields

  • 0

We have a panel which displays a form with an arbitrary number of JTextFields, JComboBoxes and JTextAreas (each with a corresponding JLabel).

The current code uses a GridBagLayout but I’d like to know if there is already a layout for this kind of task (playing with WrapLayout at the moment but aligning the fields seems tricky).

Is there any layouts particularly for this or am I best just sticking with the lovely GridBagLayout code we already have?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:18:36+00:00Added an answer on June 1, 2026 at 12:18 pm

    I would almost always recommend the JGoodies FormLayout as layout when you create a form. The documentation contains an example of a layout with a dynamic number of components (code snippet 6, which I copy-paste here to give you an idea)

    FormLayout layout = new FormLayout(
    “right:max(40dlu;p), 4dlu, 80dlu, 7dlu, ” // 1st major column
    + “right:max(40dlu;p), 4dlu, 80dlu”, // 2nd major column
    “”); // add rows dynamically
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.appendSeparator(“Segment”);
    builder.append(“Identifier”, idField);
    builder.nextLine();
    builder.append(“PTI [kW]”, ptiField);
    builder.append(“Power [kW]”, powerField);
    builder.append(“len [mm]”, lenField);
    builder.nextLine();
    builder.appendSeparator(“Diameters”);
    builder.append(“da [mm]”, daField);
    builder.append(“di [mm]”, diField);
    builder.append(“da2 [mm]”, da2Field);
    builder.append(“di2 [mm]”, di2Field);
    builder.append(“R [mm]”, rField);
    builder.append(“D [mm]”, dField);
    

    They have a demo available through Java web start

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a panel which displays Form objects. When the Close() method is called
I have a panel which consists of a toolbar and tabs. On each tab
I have web form with a panel which has form elements in side it.
i have a panel (A), which contains 3 other panels (AA, AB, AC). Each
I have a form with a panel in which I want to display an
We have a form which displays media items in tab pages of a tab
I have a panel with transparent background which i use to draw an image.
I have a preferences panel in my application in which I have a NSColorWell
I have a button which is in update panel. When I click on button
I have made a basic ascx control which is just a panel with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.