Label in frame(Eclipse)
I have a JInternalframe
in the Eclipse Visual Editor but it does not have a JContentPane
.
When I drag a J开发者_StackOverflow社区Label
onto it I can't re-size it but when I put a JContentPane
in the JInternalframe
and make its layout NULL the label can be re-sized.
Can someone help me how to put re-sizable label in a JInternalframe
without a JContent
pane?
The size of the elements in Swing is very integrated to the type of layout your using. Null layout lets specify the sizes, but you should avoid it. Border Layout lets you specify preferred, minimum and maximum values for the width and height.
I recommend to find a layout that suits your needs and use it. Some of them will resize the JLabel to fit its contents, some others will let you specify the size you want.
精彩评论