1 30 31 package com.jgoodies.looks.plastic; 32 33 import java.awt.event.MouseEvent ; 34 35 import javax.swing.AbstractButton ; 36 import javax.swing.plaf.basic.BasicButtonListener ; 37 38 46 47 final class ActiveBasicButtonListener extends BasicButtonListener { 48 49 private boolean mouseOver; 50 51 ActiveBasicButtonListener(AbstractButton b) { 52 super(b); 53 mouseOver = false; 54 } 55 56 public void mouseEntered(MouseEvent e){ 57 super.mouseEntered(e); 58 AbstractButton button = (AbstractButton ) e.getSource(); 59 button.getModel().setArmed(mouseOver = true); 60 } 61 62 public void mouseExited(MouseEvent e){ 63 super.mouseExited(e); 64 AbstractButton button = (AbstractButton ) e.getSource(); 65 button.getModel().setArmed(mouseOver = false); 66 } 67 68 public void mouseReleased(MouseEvent e){ 69 super.mouseReleased(e); 70 AbstractButton button = (AbstractButton ) e.getSource(); 71 button.getModel().setArmed(mouseOver); 72 } 73 74 } | Popular Tags |