Java JList getStoredBackground(JList comp)

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

Description

get Stored Background

License

Open Source License

Declaration

private static Color getStoredBackground(JList comp) 

Method Source Code


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

import javax.swing.JComboBox;

import javax.swing.JLabel;
import javax.swing.JList;

import javax.swing.text.JTextComponent;

public class Main {
    /**/*from   ww  w  .j  a v  a2 s  .c o  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);
    }

    private static Color getStoredBackground(JComboBox comp) {
        return (Color) comp.getClientProperty(STORED_BACKGROUND_KEY);
    }

    private static Color getStoredBackground(JList comp) {
        return (Color) comp.getClientProperty(STORED_BACKGROUND_KEY);
    }

    private static Color getStoredBackground(JLabel comp) {
        return (Color) comp.getClientProperty(STORED_BACKGROUND_KEY);
    }
}

Related

  1. applyDefaultProperties(final JList comp)
  2. clearList(JList list)
  3. ensureCustomBackgroundStored(JList comp)
  4. ensureRangeIsVisible(JList list, int top, int bottom)
  5. filterDataList(JList jList, List dataList, String text)
  6. getVisibleRowCount(JList list)
  7. indexList(JList list, Object object)
  8. indexOf(JList jList, Object obj)
  9. isDoubleClick(MouseEvent evt, JList lst, JButton btn)