Re: adding a List of JTextField to the GUI



thufir wrote:

here's what I have:

If all you need right now is just to get some labels and text fields displayed, you could do it by adding a label and a text field to one panel, then just stack the panels on top of each other. That's not nearly as sophisticated as what the GroupLayout will let you do, but it'll get you a working JFrame.

class TestApp extends JFrame {

TestApp() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
add(panel);
for (int i = 1; i <= 4; i++) {
JPanel nuPanel = new JPanel();
nuPanel.add(new JLabel("Label " + i));
nuPanel.add(new JTextField(i * 4));
panel.add(nuPanel);
}
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
}

public static void main(String[] args) {
new TestApp().setVisible(true);
}
}
.



Relevant Pages

  • Re: Dynamic Controls - Still!
    ... I've got another page where the same code works just fine, but the labels ... A panel derives from Control just like the Page ... > Dim ddl As DropDownList = New DropDownList ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: The Electricians Credo, part XXXIV
    ... owns the house know which breaker goes where. ... The NEC requires the panel to be labeled, ... Typically you'll get general labels like first floor lighting, ... The electrician that wired my house made a computer printed label that ...
    (alt.home.repair)
  • Re: performance
    ... >I'm going to create a web form to show some textboxes to users, ... I'm thinking not using 2 pages but use panel ... >server control to group my textboxes and labels, before postback, i ... My questions is hiding a lot of server controls will be ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: VB .NET dynamic number of controls...
    ... > I've been trying todo this by creating arrays of progressbars and labels. ... > progress on, I create a bar and label and add them to a panel. ... no labels, no progress bars. ...
    (microsoft.public.dotnet.general)
  • Re: Panel & click event
    ... If you were just doing text you could use a panel. ... labels on the panel and handle the click event of the panel. ... picture box for the graphics you can handle the click event for it. ... I'm trying to create rectangular areas that contain labels, ...
    (microsoft.public.dotnet.framework.compactframework)