1 7 8 48 49 package org.jdesktop.swing.actions; 50 51 import java.beans.PropertyChangeListener ; 52 import java.beans.PropertyChangeEvent ; 53 54 import javax.swing.AbstractButton ; 55 56 60 class ToggleActionPropertyChangeListener implements PropertyChangeListener { 61 62 private AbstractButton button; 68 69 public ToggleActionPropertyChangeListener(AbstractButton button) { 70 this.button = button; 71 } 72 73 public void propertyChange(PropertyChangeEvent evt) { 74 String propertyName = evt.getPropertyName(); 75 76 if (propertyName.equals("selected")) { 77 Boolean selected = (Boolean )evt.getNewValue(); 78 button.setSelected(selected.booleanValue()); 79 } 80 } 81 } 82 | Popular Tags |