i am learning Java at the moment and have the following question:
i am adding my controls to JFrame and then pack() before displaying.
this runs the application and all is very nice.
i was wondering is there a way to stop the user from resizing the application window?
also is there a way to for the image in JLabel to expand as the user changes the application window?
at the moment i have it as:
constraints.fill = GridBagConstraints.BOTH;
constraints.anchor = GridBagConstraints.CENTER;
and it only centers the image, i would like to be able to expand/shrink the image.
thanks.
If you don’t want to allow users to resize your window at all then you can do
I’m not sure that this technique can be successfully used at the same time with
pack(). You should certainly try, but I remember there was an issue that if you do:then
pack()simply doesn’t do what it should and if you do:then you window becomes a little more narrow then after only
pack(). Of course, some workaround can be found (or maybe even it’s just my bad experience).