Centering a JLabel in a JPanel
问题 I have a panel derived from JPanel . I have a custom control derived from JLabel . I am attempting to center this custom JLabel on my panel. The only way I know to do this that will work is to use the a null layout ( setLayout(null) ) and then calculate the custom JLabel's setLocation() point so that it's in the right spot. The custom JLabel is physically moved from one panel to this panel in this app and I believe the location previously set in setLocation is affecting things. However when I