开发者

JComponent: How can it resist smallification?

开发者 https://www.devze.com 2022-12-19 03:59 出处:网络
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

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

精彩评论

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

关注公众号