com.jstatcom.component
Class CardPanelAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.jstatcom.component.CardPanelAction
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
public final class CardPanelAction extends javax.swing.AbstractActionAn action for the task of showing a "card" component in aCardDisplayPanel.The "card" component is only constructed when
getComponentis called the first time. This way the component gets only created when the respectiveCardPanelActionis actually called. This may led to faster program start.- See Also:
CardDisplayPanel, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description CardPanelAction(java.lang.String className, CardDisplayPanel parent, boolean enabled, java.lang.String name)Creates an action object that constructs a component on demand according to the arguments.CardPanelAction(java.lang.String className, CardDisplayPanel parent, boolean enabled, java.lang.String name, javax.swing.Icon icon)Creates an action object that constructs a component on demand according to the arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidactionPerformed(java.awt.event.ActionEvent arg1)Invoked when this action is called.javax.swing.JComponentgetComponent()Gets the component defined viaclassNamein the constructor.
-
-
-
Constructor Detail
-
CardPanelAction
public CardPanelAction(java.lang.String className, CardDisplayPanel parent, boolean enabled, java.lang.String name)Creates an action object that constructs a component on demand according to the arguments.- Parameters:
className- the string with the fully qualified class name of the component to construct when this action is calledparent- the parent panelenabled-trueif this action should be enabledname- the name of this action- Throws:
java.lang.IllegalArgumentException-if (className == null)orif (parent == null)
-
CardPanelAction
public CardPanelAction(java.lang.String className, CardDisplayPanel parent, boolean enabled, java.lang.String name, javax.swing.Icon icon)Creates an action object that constructs a component on demand according to the arguments.- Parameters:
className- the string with the fully qualified class name of the component to construct when this action is calledparent- the parent panelenabled-trueif this action should be enabledname- the name of this actionicon- an icon to be displayed by components taking thisAbstractActionas argument- Throws:
java.lang.IllegalArgumentException-if (className == null)orif (parent == null)
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent arg1)
Invoked when this action is called. Creates the respective component if it has not been created before and callsshowCardof the parentCardDisplayPanel.- Parameters:
arg1- argument is ignored and can benull
-
getComponent
public javax.swing.JComponent getComponent()
Gets the component defined viaclassNamein the constructor. If this method is called the first time, the component is first created.- Returns:
- the component that has been defined via its class name in the
constructor of this action, if the object construction failes, am
empty
JPanelwith a message is returned
-
-
DMelt 3.0 © DataMelt by jWork.ORG