Code Search for Developers
 
 
  

EnabledLabel.java from GridBlocks at Krugle


Show EnabledLabel.java syntax highlighted

/*
 * Copyright (c) 2007
 * Helsinki Institute of Physics
 * see LICENSE file for details
 *
 * EnabledLabel.java
 */

package fi.hip.gb.client.ui;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.JComponent;
import javax.swing.JLabel;

/**
 * A label which will change its color according to the attached component's state.
 * When component is enabled, label uses its foreground color, otherwise it's displayed
 * in dimmed color (gray). Constructor assumes, that the component is currently
 * in enabled state.
 * 
 * @author Juho Karppinen
 */
public class EnabledLabel extends JLabel {
    private static final long serialVersionUID = 2628839786733150897L;
    
    /** the component to be enabled/disabled */
	private JComponent component;

	/**
	 * Creates a new EnabledLabel which will change its color
	 * according to the attached component's state. When component
	 * is enabled, label uses its foreground color, otherwise it's displayed
	 * in dimmed color (gray). Constructor assumes, that the component is currently
	 * in enabled state.
	 * @param compToFollow component which color will be changed
	 * @param labelText text for the label
	 **/
	public EnabledLabel(JComponent compToFollow, String labelText) {
		super(labelText);
		component = compToFollow;
		component.addPropertyChangeListener(new PropertyListener());
	}

	private class PropertyListener implements PropertyChangeListener {
		public void propertyChange(PropertyChangeEvent e) {
			setEnabled(component.isEnabled());
		}
	}
}




See more files for this project here

GridBlocks

GridBlocks builds a grid application framework via easy-to-use building blocks in distributed environment. The framework offers components for Grid security, distributed storage, computing, and Portlet web interfaces.

Project homepage: http://sourceforge.net/projects/gridblocks
Programming language(s): Java,JSP,XML
License: other

  myproxy/
    MyProxyGUI.java
    MyProxyOptions.java
    PasswordDialog.java
    package.html
  treetable/
    AbstractTreeTableModel.java
    DynamicTreeTableModel.java
    JTreeTable.java
    QuestionCellEditorModel.java
    RightClickAdapter.java
    TreeTableCellRenderer.java
    TreeTableModel.java
    TreeTableModelAdapter.java
    package.html
  AgentProgressIndicator.java
  EnabledLabel.java
  JobListItem.java
  SoundObserver.java
  TextObserver.java
  Utils.java
  Window.java
  package.html