Public Member Functions | |
| JMultiIconLabel () | |
| JMultiIconLabel (String[] resourceNames) | |
| JMultiIconLabel (String[] resourceNames, int horizontalAlignement) | |
| JMultiIconLabel (javax.swing.Icon[] icons) | |
| JMultiIconLabel (javax.swing.Icon[] icons, int horizontalAlignment) | |
| void | addIcon (String resourceName) |
| void | addIcon (javax.swing.Icon icon) |
| void | addIcons (String[] resourceNames) |
| void | addIcons (Icon[] icons) |
| Icon | getIconByIndex (int index) |
| void | setIconByIndex (int index) |
Protected Member Functions | |
| Icon | loadFromResource (String resourceName) |
Private Attributes | |
| final java.util.Vector | iconList = new java.util.Vector() |
This class extends javax.swing.JLabel so that it allows display of multiple icons. It maintains internal list of icons that associates integer values with Icon objects. This index is guaranteed to be valid even if the desired icon could not be found, is not valid or is null. In such cases the corresponding icon will not be displayed.
Icons can be provided by either the calling class via the javax.swing.Icon object or they can be loaded from the projects resource automatically. Two methods are provided to add the icons: addIcon, addIcons The later is preffered when adding multiple icons at the same time.
Use the setIconByIndex method to set which icon should be displayed.
The disabled state icon of the JLabel is not overriden and can be still specified.
Creation date: (12/24/2001 15:57:21)
| com::cosylab::gui::components::r2::JMultiIconLabel::JMultiIconLabel | ( | ) | [inline] |
Default constructor for JMultiIconLabel.
| com::cosylab::gui::components::r2::JMultiIconLabel::JMultiIconLabel | ( | String[] | resourceNames | ) | [inline] |
Constructs a JMultiIconLabel and loads the icons from the specified resource names.
| text | java.lang.String |
References addIcons().
| com::cosylab::gui::components::r2::JMultiIconLabel::JMultiIconLabel | ( | String[] | resourceNames, | |
| int | horizontalAlignement | |||
| ) | [inline] |
Constructs a JMultiIconLabel and loads the icons from the specified resource names. Also sets the horizontal alignement of the text.
| text | java.lang.String | |
| horizontalAlignement | int. |
References addIcons().
| com::cosylab::gui::components::r2::JMultiIconLabel::JMultiIconLabel | ( | javax.swing.Icon[] | icons | ) | [inline] |
Constructs a JMultiIconLabel and adds the icons to the icon list.
| image | javax.swing.Icon |
References addIcons().
| com::cosylab::gui::components::r2::JMultiIconLabel::JMultiIconLabel | ( | javax.swing.Icon[] | icons, | |
| int | horizontalAlignment | |||
| ) | [inline] |
Constructs a JMultiIconLabel and adds the icons to the icon list. Also sets the horizontal alignement of the text.
| image | javax.swing.Icon | |
| horizontalAlignment | int |
| void com::cosylab::gui::components::r2::JMultiIconLabel::addIcon | ( | javax.swing.Icon | icon | ) | [inline] |
Appends the icon to the list of icons.
Creation date: (12/24/2001 16:02:13)
| icon | javax.swing.Icon |
References iconList.
| void com::cosylab::gui::components::r2::JMultiIconLabel::addIcon | ( | String | resourceName | ) | [inline] |
Appends the icon specified by resourceName to the end of internal list of icons. This method calls addIcon(Icon) and loadFromResource(String). If resourceName does not exist in the projects resources, method adds empty icon.
Creation date: (12/24/2001 16:14:15)
| resourceName | java.lang.String |
References loadFromResource().
Referenced by addIcons().
| void com::cosylab::gui::components::r2::JMultiIconLabel::addIcons | ( | Icon[] | icons | ) | [inline] |
Appends all icons specified by icons parameter to the internal list of icons. For adding multiple icons, this method outperforms individual calls to addIcon method.
After calling this method, the list of icons will grow by the size of the array, regardless of its contentrs. If any of the icons is null or of invalid type, the associated icon will not be displayed.
Creation date: (12/24/2001 16:17:36)
| icons | javax.swing.Icon[] |
References addIcon().
| void com::cosylab::gui::components::r2::JMultiIconLabel::addIcons | ( | String[] | resourceNames | ) | [inline] |
Appends all icons specified by resourceNames to the end of internal list of icons. For adding multiple icons, this method outperforms individual calls to addIcon method.
After calling this method, the list of icons will grow by the size of the array, regardless of its contentrs. If any of the icons is null or of invalid type, the associated icon will not be displayed.
Creation date: (12/24/2001 16:21:36)
| resourceNames | java.lang.String[] |
References addIcon().
Referenced by JMultiIconLabel().
| Icon com::cosylab::gui::components::r2::JMultiIconLabel::getIconByIndex | ( | int | index | ) | [inline] |
Returns the Icon resource assigned to the specified index. If the icon has not been defined, returns null.
Creation date: (12/24/2001 16:10:44)
| index | int |
References iconList.
Referenced by setIconByIndex().
| Icon com::cosylab::gui::components::r2::JMultiIconLabel::loadFromResource | ( | String | resourceName | ) | [inline, protected] |
Loads the Icon from the projects resource. Returns null if the resource does not exist.
Creation date: (12/24/2001 16:04:52)
| resourceName | java.lang.String |
Referenced by addIcon().
| void com::cosylab::gui::components::r2::JMultiIconLabel::setIconByIndex | ( | int | index | ) | [inline] |
Displays the icon specified by index. If the icon with this index has not been defined, no icon will be displayed.
Creation date: (12/24/2001 16:09:33)
| index | int |
References getIconByIndex().
final java.util.Vector com::cosylab::gui::components::r2::JMultiIconLabel::iconList = new java.util.Vector() [private] |
Referenced by addIcon(), and getIconByIndex().
1.6.2