Re: adding new textfield after window already drawn--partially working



On 2006-01-28, Brandon McCombs penned:
> Brandon McCombs wrote:
>> hello,
>>
>> I have a JDIalog window that is created when a user double clicks
>> on an entry in a JList. The list contains LDAP objects and the
>> attributes and attribute values for the object are shown in the
>> JDialog. Since the # of attribs/vals varies I dynamically build
>> the textfields to show all of them. I am trying to add ability to
>> add another value for any particular attribute. I got code in place
>> that is able to determine where in the window to create the text
>> field but the field doesn't show up. I've called paint() to make
>> the JDialog redraw in the hopes it was that easy but it didn't
>> work. Am I going to be forced to move all textfields that are
>> below the location where the new one goes so that they make room
>> for the new one? What is the normal way to attempt something like
>> this? I'm using gridbag layout if that matters and I have a grid
>> setup that lines up the textfields (values of attributes) with
>> labels (attribute names). thanks
>
> Soon after I posted this I tried to resize the window and that made
> the new text field show up however I lose my vertical scroll bar for
> some reason as soon as I resize. Also, starting on the 3rd attribute
> for the objects I get the new textfield showing up over top of the
> existing textfield for that attribute and whatever is causing that
> makes any other textfield created below that position be off by 1.
> That is probably something in my code doing that (no clue why
> though) but does anyone know how I can get the textfield to show up
> w/o having to resize the window and how to fix the vertical scroll
> bar? thanks

Have you tried calling repaint() on the JDialog instead of paint()?

--
monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
.