org.malai.widget
Class MButtonIcon

java.lang.Object
  extended by org.malai.widget.MButtonIcon
All Implemented Interfaces:
java.io.Serializable, javax.swing.Icon

public class MButtonIcon
extends java.lang.Object
implements javax.swing.Icon, java.io.Serializable

A button icon can be used in a Button (JButton, MButton) to display a colour in a button.

This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN

Malai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

06/05/2010

Since:
0.2
Version:
0.2
Author:
Arnaud BLOUIN
See Also:
Serialized Form

Field Summary
private  java.awt.Color color
          The colour of the icon
static java.awt.Color EDGE
          The colour of the borders of the icon
static int HEIGHT
          he height of the icon
private static long serialVersionUID
           
static int WIDTH
          The width of the icon
 
Constructor Summary
MButtonIcon(java.awt.Color color)
          The constructor using a colour.
 
Method Summary
 java.awt.Color getColor()
           
 int getIconHeight()
           
 int getIconWidth()
           
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
           
 void setColor(java.awt.Color c)
          Sets the colour of the interior of the icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

color

private java.awt.Color color
The colour of the icon


EDGE

public static final java.awt.Color EDGE
The colour of the borders of the icon


WIDTH

public static final int WIDTH
The width of the icon

See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
he height of the icon

See Also:
Constant Field Values
Constructor Detail

MButtonIcon

public MButtonIcon(java.awt.Color color)
The constructor using a colour.

Parameters:
color - The colour of the icon.
Throws:
java.lang.IllegalArgumentException - if the given colour is null.
Method Detail

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface javax.swing.Icon

getColor

public java.awt.Color getColor()
Returns:
The colour of the interior of the icon

setColor

public void setColor(java.awt.Color c)
Sets the colour of the interior of the icon.

Parameters:
c - The new Colour of the interior of the icon. If null, nothing is done.

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface javax.swing.Icon

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface javax.swing.Icon