开发者

JComponent: How can it resist smallification?

I have a custom JComponent that paints some stuff when paint is called. In a Border layout, though, it's minimumSize is not being respected. I've included this

@Override
public Dimension getMinimumSize() {
    System.out.println("asking for min size");
    return MINIMUM_SIZE;
}

and it never gets called. I've also tried setting min size on the containe开发者_如何转开发r that holds it, and on the JFrame that holds that. How can I put some limits in here?


I don't think BorderLayout respects minimum sizes; it just sizes things to fit the container. You should try another layout (perhaps BoxLayout).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜