JButton with transparent images and no borders. More...


Public Member Functions | |
| JImageButton (Object resourceOwner, String tooltip, String iconPath, String rolloverIconPath) | |
| Creates button with the tool tip and two icons (one normal and one rollover)   | |
| void | focusGained (FocusEvent evt) | 
| On focus gained, sets icon to 'in focus' icon.   | |
| void | focusLost (FocusEvent evt) | 
| On focus lost, resets icon to normal.   | |
Static Public Member Functions | |
| static ImageIcon | loadIcon (Object resourceOwner, String name) | 
| Loads icon from resources or file system.   | |
Private Attributes | |
| ImageIcon | normalIcon | 
| ImageIcon | inFocusIcon | 
Static Private Attributes | |
| static final long | serialVersionUID = 2446005873909591693L | 
JButton with transparent images and no borders.
Definition at line 17 of file JImageButton.java.
| ui.JImageButton.JImageButton | ( | Object | resourceOwner, | 
| String | tooltip, | ||
| String | iconPath, | ||
| String | rolloverIconPath | ||
| ) | 
Creates button with the tool tip and two icons (one normal and one rollover)
Definition at line 27 of file JImageButton.java.
References ui.JImageButton.inFocusIcon, ui.JImageButton.loadIcon(), and ui.JImageButton.normalIcon.
    {
        setToolTipText( tooltip );
        /* Set icons
         */
        normalIcon = loadIcon( resourceOwner, iconPath );
        inFocusIcon = loadIcon( resourceOwner, rolloverIconPath );
        
        setIcon( normalIcon );
        setRolloverIcon( inFocusIcon );
        
        /* Make button background transparent and without borders
         */
        setBorderPainted( false );
        setOpaque( false );
        setBackground( new Color(0,0,0,0) );
        
        addFocusListener( this );
    }
| void ui.JImageButton.focusGained | ( | FocusEvent | evt ) | 
On focus gained, sets icon to 'in focus' icon.
Definition at line 74 of file JImageButton.java.
References ui.JImageButton.inFocusIcon.
    {
        setIcon( inFocusIcon );
        setBackground( null );
    }
| void ui.JImageButton.focusLost | ( | FocusEvent | evt ) | 
On focus lost, resets icon to normal.
Definition at line 84 of file JImageButton.java.
References ui.JImageButton.normalIcon.
    {
        setIcon( normalIcon );
        setBackground( new Color(0,0,0,0) );
    }
| static ImageIcon ui.JImageButton.loadIcon | ( | Object | resourceOwner, | 
| String | name | ||
| ) |  [static] | 
        
Loads icon from resources or file system.
Definition at line 52 of file JImageButton.java.
Referenced by CryptoPhoneApp.CryptoPhoneApp(), ui.JImageButton.JImageButton(), and ui.JSecState.JSecState().
    {
        String path = "resources/images/" + name;
        
        /* First try from class resources
         */
        URL url = resourceOwner.getClass().getResource( path );
        
        if ( url != null ) {
            return new ImageIcon( url );
        }
        
        /* then fall back to file system...
         */
        return new ImageIcon( path );
    }
ImageIcon ui.JImageButton.inFocusIcon [private] | 
        
Definition at line 22 of file JImageButton.java.
Referenced by ui.JImageButton.focusGained(), and ui.JImageButton.JImageButton().
ImageIcon ui.JImageButton.normalIcon [private] | 
        
Definition at line 21 of file JImageButton.java.
Referenced by ui.JImageButton.focusLost(), and ui.JImageButton.JImageButton().
final long ui.JImageButton.serialVersionUID = 2446005873909591693L [static, private] | 
        
Definition at line 19 of file JImageButton.java.
 1.7.2