unbind Swing Action From Listener - Java Swing

Java examples for Swing:Action

Description

unbind Swing Action From Listener

Demo Code


//package com.java2s;

import java.beans.PropertyChangeListener;

import javax.swing.Action;

public class Main {
    public static void unbindActionTFromListener(Action action,
            Object object) {//from w  ww.  ja v a 2 s .  c  o  m
        Object listener = action.getValue("listener");
        if (listener instanceof PropertyChangeListener) {
            action.removePropertyChangeListener((PropertyChangeListener) listener);
            action.putValue("listener", null);
        }
    }
}

Related Tutorials