问题描述
我有两个问题,可以通过以下屏幕截图来说明:
I have two problem, which can be illustrated by these screenshots:
那么,在这种情况下如何避免文本被截断?当然,宽度就足够了.此外,截断对于不同的字符串也有所不同.
So, how to avoid text's truncation in these case ? Of course, the width is enough.Moreover, truncation differs for differen strings.
推荐答案
我怀疑布局或首选尺寸问题.您可以覆盖 ChartPanel
中的 getPreferredSize()
以获得漂亮的初始显示,如此处,并指定 BorderLayout.CENTER
或 GridLayout
之类的布局,以使面板采用封闭的 Container
的大小.失败的话,请编辑您的问题,以包含显示您遇到的任何问题的 sscce .
I suspect a layout or preferred size problem. You can override getPreferredSize()
in ChartPanel
to get a nice initial display, as shown here, and specify a layout like BorderLayout.CENTER
or GridLayout
to let the panel adopt the size of the enclosing Container
. Failing this, please edit your question to include an sscce that exhibits any problem you encounter.
这篇关于BarChart文本截断问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!