Reputation: 5424
I have a swing project and noticed that the elements inside the JFrame is statically located inside the JFrame and I do not have the option of resizing the elements as I want to.
My gui app inside the designer window looks like the following:
I want to resize the button (E.g.) by dragging the corners of the button, but I am not allowed to?
As you can see on the following picture, the dragging is not allowed per pixel, but only per section in the JFrame:
How can I disable the static placement of the elements/Enable the self-dragging of elements inside the designer window?
Upvotes: 0
Views: 837
Reputation: 52195
Most likely you will need to disable the LayoutManager
. On Netbeans, Setting this to null
would provide you full control over the location and dimension of the child elements, so I am assuming that something similar should work here (although you seem to be using Eclipse, if that is the case, please state what plugin you are using).
It is to be noticed however that usually you want to have a layout manager taking care of how your components are rendered. I would recommend you take a look here for some more information on layout managers prior to removing them completely.
Upvotes: 4
Reputation: 168845
Setting size and position of components in a GUI should be left to the JRE at run-time, using:
BorderLayout
and the much maligned GridBagLayout
, as well as many 3rd party layouts).Generally, complex effects are created by using a nested layout.
Upvotes: 3