com.mucommander.ui.button
Class RolloverButtonAdapter

java.lang.Object
  extended by com.mucommander.ui.button.RolloverButtonAdapter
All Implemented Interfaces:
java.awt.event.MouseListener, java.util.EventListener

public class RolloverButtonAdapter
extends java.lang.Object
implements java.awt.event.MouseListener

This class allows to add a rollover effect to a JButton. Rollover-enabled buttons have no borders by default. It is only when the mouse cursor is over the button that the button's borders get painted. This rollover effect gives the user a visual indication that the button can be pressed (in other words, that the button is indeed a button), while not cluttering the interface with button borders. Such buttons are particularly effective for toolbars, where a large number of buttons are usually present.

To 'rollover-enable' a button, the setButtonDecoration(javax.swing.JButton) method must first be called to set decoration properties. Then, the button must register an instance of RolloverButtonAdapter as a mouse listener. Note that a single RolloverButtonAdapter instance can be registered with several buttons.

Author:
Maxence Bernard

Constructor Summary
RolloverButtonAdapter()
          Creates a new RolloverButtonAdapter.
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
static void setButtonDecoration(javax.swing.JButton button)
          Sets the decoration properties required to give the specified button a 'rollover' look and feel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RolloverButtonAdapter

public RolloverButtonAdapter()
Creates a new RolloverButtonAdapter.

Method Detail

setButtonDecoration

public static void setButtonDecoration(javax.swing.JButton button)
Sets the decoration properties required to give the specified button a 'rollover' look and feel.

Parameters:
button - the button to 'rollover-enable'

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard