Pergunta

I have some problems with swing painting.

My following UI (take a look at the next picture) has a JTextField on the left side, which has the possibility to show autocompletion hints. On the right side, elements, which where selected from the textfield, should be shown. These elements are contained by an JPanel which uses a FlowLayout(FlowLayout.LEFT) as layout manager.

my ui

Now when selecting some elements from the textfield, which will be added to the flowlayout, the elements won't be painted. (Shown in the next picture) New elements won't be painted

Now I have two possibilities to show these non painted elements.

First: After resizing the JFrame the elements will be shown.

Second: Selecting enough elements so that the FlowLayout has to take a line break. After a line break all elements will be shown. When selecting additional elements they won't be shown till the next line break.

Elements after a FlowLayout line break:

Elements after a FlowLayout line break

What can I do?

Foi útil?

Solução

Exchanging FlowLayout throw custom WrapLayout fixed the problem. Seems it was a layout problem.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top