BasicLabelUI.java revision 1859
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* A Windows L&F implementation of LabelUI. This implementation
* is completely static, i.e. there's only one UIView implementation
* that's shared by all JLabel objects.
*
* @author Hans Muller
*/
{
/**
* The default <code>BasicLabelUI</code> instance. This field might
* not be used. To change the default instance use a subclass which
* overrides the <code>createUI</code> method, and place that class
* name in defaults table under the key "LabelUI".
*/
}
/**
* Forwards the call to SwingUtilities.layoutCompoundLabel().
* This method is here so that a subclass could do Label specific
* layout and to shorten the method name a little.
*
* @see SwingUtilities#layoutCompoundLabel
*/
{
return SwingUtilities.layoutCompoundLabel(
(JComponent) label,
text,
icon,
label.getIconTextGap());
}
/**
* Paint clippedText at textX, textY with the labels foreground color.
*
* @see #paint
* @see #paintDisabledText
*/
{
int mnemIndex = l.getDisplayedMnemonicIndex();
g.setColor(l.getForeground());
}
/**
* Paint clippedText at textX, textY with background.lighter() and then
* shifted down and to the right by one pixel with background.darker().
*
* @see #paint
* @see #paintEnabledText
*/
{
int accChar = l.getDisplayedMnemonicIndex();
}
/**
* Paint the label text in the foreground color, if the label
* is opaque then paint the entire background with the background
* color. The Label text is drawn by paintEnabledText() or
* paintDisabledText(). The locations of the label parts are computed
* by layoutCL.
*
* @see #paintEnabledText
* @see #paintDisabledText
* @see #layoutCL
*/
{
return;
}
}
if (v != null) {
v.paint(g, paintTextR);
} else {
int textX = paintTextR.x;
}
else {
}
}
}
}
}
{
}
}
else {
return rv;
}
}
/**
* @return getPreferredSize(c)
*/
Dimension d = getPreferredSize(c);
if (v != null) {
}
return d;
}
/**
* @return getPreferredSize(c)
*/
Dimension d = getPreferredSize(c);
if (v != null) {
}
return d;
}
/**
* Returns the baseline.
*
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
return -1;
}
}
/**
* Returns an enum indicating how the baseline of the component
* changes as the size changes.
*
* @throws NullPointerException {@inheritDoc}
* @see javax.swing.JComponent#getBaseline(int, int)
* @since 1.6
*/
JComponent c) {
super.getBaselineResizeBehavior(c);
}
switch(((JLabel)c).getVerticalAlignment()) {
}
}
public void installUI(JComponent c) {
installDefaults((JLabel)c);
installComponents((JLabel)c);
installListeners((JLabel)c);
}
public void uninstallUI(JComponent c) {
uninstallDefaults((JLabel)c);
uninstallListeners((JLabel)c);
}
protected void installDefaults(JLabel c){
}
protected void installListeners(JLabel c){
c.addPropertyChangeListener(this);
}
protected void installComponents(JLabel c){
c.setInheritsPopupMenu(true);
}
protected void installKeyboardActions(JLabel l) {
int dka = l.getDisplayedMnemonic();
"Label.actionMap");
inputMap = new ComponentInputMapUIResource(l);
}
false), "press");
}
else {
}
}
}
protected void uninstallDefaults(JLabel c){
}
protected void uninstallListeners(JLabel c){
c.removePropertyChangeListener(this);
}
protected void uninstallComponents(JLabel c){
}
protected void uninstallKeyboardActions(JLabel c) {
null);
}
if (safeBasicLabelUI == null) {
safeBasicLabelUI = new BasicLabelUI();
}
return safeBasicLabelUI;
}
return labelUI;
}
public void propertyChange(PropertyChangeEvent e) {
// remove the old html view client property if one
// existed, and install a new one if the text installed
// into the JLabel is html source.
}
}
}
// When the accelerator is pressed, temporarily make the JLabel
// focusTraversable by registering a WHEN_FOCUSED action for the
// release of the accelerator. Then give it focus so it can
// prevent unwanted keyTyped events from getting to other components.
super(key);
}
public void actionPerformed(ActionEvent e) {
}
}
}
inputMap = new InputMapUIResource();
}
// Need this if ALT is released before the accelerator
}
}
// inputMap should never be null.
}
} else {
}
}
}
}
}