문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top