Java tutorial
//package com.java2s; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JComponent; public class Main { public static void linkEnabled(JComponent watcher, final JComponent... actor) { watcher.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("enabled")) { Boolean newValue = (Boolean) evt.getNewValue(); if (newValue) { for (JComponent j : actor) { j.setEnabled(true); } } else { for (JComponent j : actor) { j.setEnabled(false); } } } } }); } }