Skip to main content

LWUIT dialog title problem when not using dialogTitleCompatibilityMode

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-05-05

There seems to be a problem with dialog title when dialog is reused and displayed more than once.
It seems that LWUIT code is not taking into account that dialog title is not in Form's title area but instead inside Form's content pane. When displayed the 2nd time, Dialog's top property is > -1, which causes refreshTheme() to be called, which in turn causes menu to be removed and put back, during which also the title will be removed from content pane and put into Form's title area:

<br /><div>    protected void unInstallMenuBar() {</div><div>        parent.removeComponentFromForm(this);</div><div>        Container t = parent.getTitleArea();</div><div>        BorderLayout titleLayout = (BorderLayout)t.getLayout();</div><div>        titleLayout.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);</div><div>        <strong>Label l = parent.getTitleComponent();</strong></div><div><strong>        t.removeAll();</strong></div><div><strong>        if(l.getParent() != null) {</strong></div><div><strong>            l.getParent().removeComponent(l);</strong></div><div><strong>        }</strong></div><div><strong>        t.addComponent(BorderLayout.CENTER, l);</strong></div><div>    }</div>

And there is no workaround to use dialogTitleCompatibilityMode either, as it seems there is another bug in that with compatibility mode, Dialog.setTitle() recursively calls itself until stack overlow:
<div>    public void setTitle(String title) {</div><div>        if(dialogTitleCompatibilityMode) {</div><div>            <strong>setTitle(title);</strong></div><div>            return;</div><div>        }</div><div>        dialogTitle.setText(title);</div><div>    }</div>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-11-07

We must have missed it since we never recycle dialogs. Please file an issue for this in the issue tracker ideally with a way to reproduce this.