Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JLabel margin

843789May 29 2009 — edited May 29 2009
Hey everyone,

I've searched through the forums for a way to change the margin or padding of a JLabel and haven't found any results.

I have a JFrame that includes form elements, as well as images. I would like several of the images to touch eachother.

With the default layout manager it gives about 10 pixels between each element.

Is there a setMargin() method or something similar for a JLabel?

or maybe an alternative question: Is there a better way to place images in a Panel than using JLabels?

I found several who suggested using a null layout, and position manually, but it seems there should be an easier way to align images.

Thanks much!

Daniel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2009
Added on May 29 2009
6 comments
7,112 views