سؤال

What's the difference in Swing, when using GridBagLayout, between setAlignmentX and setHorizontalAlignment, on a JLabel?

لا يوجد حل صحيح

نصائح أخرى

setAlignmentX is used to align a component within the container, if the layout manager supports that property.

setHorizontalAlignment aligns the text within the actual label when the size of the label is greater than its preferred size. Again it depends on the layout manager if it respects the preferred size or not.

So create a simple SSCCE and play with the two properties to see what happens. If you don't understand something then you have a SSCCE to post on the forum.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top