java - Control spacing in Swing -


There are directions that how many place controls can swing around in the swing? Apart from this, it is a question of how to achieve: Some layout managers get support for the interval between control; Do nothing, where you have to use the empty border - which can be pain, because the boundaries do not overlap and you can end up with a lot of space between two controllers. 1 - so you may need to leave a portion of the boundary.

Another problem looks and feels: If I use clear intervals or boundaries then it may look fine in one LF but the other is bad. For example, Nimbus seems tight together with the feel of the button, because there is extra space around them. The default Windows ALF cranks them all at once without any extra space; I realized that since , Microsoft, Apple, Genome and others are basically a platform issue.

So if I have put extra space in between the controls so that the windows or metal LF, it gets very far in the nimus and possibly the other.

Then there is a whole problem of how you build your UI, on which there are serious side-effects to your birds with whom you are with spacing and boundaries. Everything can be done in a code by GridBagLayout , but it's terrible if you still need to make changes to the UI with the UI with many layout options from the many JPNL By contrast, then again

In short: How can I ensure that the controls are well distances and are suitable for fitting LAF, without any difficulty? Maybe I'm just looking at something like this - it's not so with the huge size of the swing.


1 At least this was a problem for me - maybe there is a viable solution but two controls next to each other There is a simple case to keep and you want to have a five-pixel emptiness around them - between them only five pixels, not ten. I can not see in a way that how it works by creating different boundaries in the normal direction, because on the basis of writing direction (since left and right are not necessarily controlled, but apparently always there are boundaries Are).

These types of directions are both platforms- and look and feel-dependent.

Use utility methods to find out which spacing should be used between one component and its embedding panel or two components

Although it is quite cumbersome is.

You might consider using a layout manager that directly supports it for you. Some people have suggested Miguelait, you can also see that Creates a fully transparent component to the developer.

With such layout manager, you should never set any dimension or inset, but let them work for you. Additionally, the correct PLF option is important, because the difference can vary depending on the resolution of your monitor (you can behave ugly with hi-dpi screens if they are not supported by you plf is selected).

I can not tell which PLAFs are independent of resolution (i.e. how to handle hydipi devices), but it is certain, one of them is very well and very good PLF


Comments