views:

41

answers:

1

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 container that holds it, and on the JFrame that holds that. How can I put some limits in here?

+2  A: 

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

Matt McHenry
Yeah, I'm in fact doing that. This is so Java, really: include a whole bunch of optional things that have normal names that don't mean normal things. Anyway, thanks and +1
Yar
GridBagLayout to the rescue :)
willcodejavaforfood