Hi, Sybille,

This may sound obvious, but it looks to me a JTable
is a more natural choice for your problem.

You can use the table headers as your labels, and
use JTextField as TableCellEditor. 

I never tried it myself, though.

Mingjian Song


> -----Original Message-----
> From: Sybille Breunig [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, November 13, 2001 12:07 PM
> To:   Swing Liste
> Cc:   [EMAIL PROTECTED]
> Subject:      Layout-Problems
> 
> All replies please to : [EMAIL PROTECTED]
> 
> --------------------------------------------------------------------------
> --
> --------------------
> 
> ok, it's been a long time since I've messaged this board.
> 
> I don't know if anyone it around anymore,
> 
> but I got a problem.
> 
> I have a PanelComponent that I made of a bunch of textfields.
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> these are all of different sizes...
> 
> the problem is that I want a Labeling component to go above it...
> 
> so that the labels match up with the fields below them.
> 
> so here's what it could look like:
> 
> name face feet place #
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> |_____________| |_____| |_______| |___________| |__|
> 
> so I want to be able to do this:
> 
> JPanel panel = new JPanel(new BorderLayout());
> 
> JPanel scrollPanel = new JPanel(new GridLayout(0,1));
> 
> scrollPanel.add(getLabelPanel());
> 
> scrollPanel.add(new ManyToOnePortPanel(1, true));
> 
> scrollPanel.add(new ManyToOnePortPanel(2, true));
> 
> scrollPanel.add(new ManyToOnePortPanel(3, true));
> 
> scrollPanel.add(new ManyToOnePortPanel(4, true));
> 
> scrollPanel.add(new ManyToOnePortPanel(5, true));
> 
> JScrollPane scrollPane = new JScrollPane(scrollPanel);
> 
> panel.add(scrollPane, BorderLayout.SOUTH);
> 
> panel.add(getButtonPanel(), BorderLayout.SOUTH);
> 
> and have the labels from getLanelPanel() line up perfectly with the
> ManyToOnePortPanel.
> 
> Right now, they are both GridLayouts,
> 
> but that leaves TOO much space for the small textfields..
> 
> any ideas?
> 
> rev aaron
> 
> 
> _______________________________________________
> Swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to