Label preferred size problem
I am trying to set the width and height of my image (which is actually just a label with an icon) as the same as the width and height of my screen so that it can cover the entire frame.
My code is:
Unfortunately this doesn't actually seem to affect the width and height values of my label in the free design layout, and i need to use this layout so that i may place other images in the frame without being too restricted. I have tried placing this in the customized code section of my label, to no avail, aswell as the componentshow event.
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension dim = toolkit.getScreenSize();
menubkg.setPreferredSize(new Dimension(dim.width, dim.height));
Any suggestions on what i might do/what i might be doing wrong?
Re: Label preferred size problem