Bug 23018 - JLabel with imageIcon is set incorrectly
Summary: JLabel with imageIcon is set incorrectly
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-04 14:09 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2005-07-04 14:09:32 UTC
If a JLabel, that has been constructed with a ImageIcon, is added to a container with BorderLayout and is set to the the position center, its positioned at the left side, and not in the center as it should be.

here the sollution how to change this:
change this constructor in JLabel:

public JLabel(Icon image)
  {
    this(null, image, LEADING);
  }
 
to this one:

public JLabel(Icon image)
  {
    this(null, image, CENTER);
  }