Java JTextComponent getStoredBackground(JTextComponent comp)

Here you can find the source of getStoredBackground(JTextComponent comp)

Description

Returns the background color that has been previously stored for the given component, or null if none.

License

Open Source License

Parameter

Parameter Description
comp the component to be requested

Return

the background color that has been previously stored for the given component, or null if none.

Declaration

private static Color getStoredBackground(JTextComponent comp) 

Method Source Code


//package com.java2s;
import java.awt.Color;

import javax.swing.text.JTextComponent;

public class Main {
    /**/*from w w  w .j av a  2  s.co  m*/
     * The JComponent client property key used to store a component's 
     * original background color. The stored background can be restored later.
     * 
     * @see #getStoredBackground(JTextComponent)
     * @see #restoreBackground(JTextComponent)
     * @see #ensureCustomBackgroundStored(JTextComponent)
     * @see #setMandatoryBackground(JTextComponent)
     */
    private static final String STORED_BACKGROUND_KEY = "validation.storedBackground";

    /**
     * Returns the background color that has been previously stored for
     * the given component, or <code>null</code> if none.
     * 
     * @param comp  the component to be requested 
     * @return the background color that has been previously stored for
     *     the given component, or <code>null</code> if none.
     * 
     * @see #ensureCustomBackgroundStored(JTextComponent)
     * @see #restoreBackground(JTextComponent)
     */
    private static Color getStoredBackground(JTextComponent comp) {
        return (Color) comp.getClientProperty(STORED_BACKGROUND_KEY);
    }
}

Related

  1. getNumberOfLines(final JTextComponent component)
  2. getParagraphElement(JTextComponent c, int offs)
  3. getPositionBelow(JTextComponent c, int offs, int x)
  4. getPreferredScrollableViewportSize(javax.swing.text.JTextComponent t, Dimension ans)
  5. getRenderedLineOfChar(JTextComponent comp, int charIdx)
  6. getStoredBackground(JTextComponent comp)
  7. highlighterIsNext(JTextComponent textComponent, boolean forwards, Highlighter.Highlight highlight)
  8. implyDisabled(final JCheckBox checked, final boolean checkedState, final JTextComponent changed)
  9. inScrollPane(JTextComponent textComponent, boolean autoscroll)