I have been having a problem with easily getting multiple pairs of labels and text fields on a JFrame. Not actually a problem, but a hassle. If I want this - My Label ----Text Field---- Anthr Lbl ----Text Field---- Third Lbl ----Text Field---- (Thats really rough ASCII'ish art!) I find myself having to do one of 2 things - - Create a panel and set its layout manager to gridbag or grid, then add each pair of components - Create a panel and set the manager to box layout, then create a sub-panel for each label/text field pair using a flow layout My solution is to create a custom JComponet, which has a label and a text field combined. It has to at least act this way, internally it can be whatever works best. Does anyone have any suggestions for how to implement this? Can I do it by actually using a label and text field internally? All help appreciated! Regards, Aaron R> [ December 29, 2003: Message edited by: Aaron Roberts ]
You would just make a new "component" of a JPanel with a JLabel and a JTextfield inside it, and add some methods to the class to set and get the text from the label and textfield. It would be just like the sub-panel in the box layout example you gave, only the subpanel will be a separate class. [ December 30, 2003: Message edited by: Nathan Pruett ]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Sounds like a plan. I have a layout I did, not related to this one, where I couldn't figure out a solution, except to layer 3 or 4 panels inside each other. I'm worried about performance, due to all the nested panels. Is that really an issue? Should I even be concerned with that here with my 'component'? Regards, Aaron R>