Class fvaswing.components.FvLabelButton

Description

Label act as a button.

Thanks to iiley for this class, you can retreive it in Aswing extension page named XLabelButton :
http://www.aswing.org/display/AsWing/XLabelButton

FvLabelButton class is defined here to avoid mulitple different classes location.

Fever feature like :

   var button : FvLabelButton = new FvLabelButton( "click me please" );
   button.setSoundID( "click" );
   button.setShortcut( new KeyCombo( Keyboard.onKeyCONTROL, Keyboard.onKeyO ) );
   button.setToolTipText( "open file" );
   button.addActionListener( _onClick, this );
 

You can use auto label shortcut definition too : ( passing null as key argument :

   var button : FvLabelButton = new FvLabelButton( "click &me please" );
   button.setShortcut( null, "myKeyMap" );
   button.setToolTipText( "open file" );
   button.addActionListener( _onClick, this );
 

Method Index

new FvLabelButton()
addActionListener(), getDisabledColor(), getHightlightColor(), getLocalisationID(), getNormalColor(), getSoundID(), getText(), getTooltipTextWithoutShortcut(), releaseShortcut(), setContent(), setDisabledColor(), setEnabled(), setFont(), setHightlightColor(), setLocalisationID(), setNormalColor(), setShortcut(), setSoundID(), setText(), setToolTipText()

Constructor Detail

FvLabelButton

public function FvLabelButton(caption, icon, horizontalAlignment:Number)

FvLabelButton( text : String, icon : Icon, horizontalAlignment : Number )
FvLabelButton( text : String, icon : Icon )
FvLabelButton( text : String, horizontalAlignment : Number)
FvLabelButton( text : String )
FvLabelButton( icon : Icon, horizontalAlignment : Number)
FvLabelButton( icon : Icon )
FvLabelButton()

Method Detail

setContent

public function setContent(caption:String, icon:Icon):Void

Sets text and icon at one method here.

Parameters

iconthe default icon for the label

setText

public function setText(caption:String):Void

Sets button label.

Checks if passed-in caption contains SHORTCUT_CHAR.
If true automatically build a new shortcut for button.

Parameters

captionButton label

getText

public function getText():String

Returns button label.
Without any shortcut marker ( if present )

setSoundID

public function setSoundID(soundID:String):Void

Sets sound id to play when user click on button.

Sounds id is searched in current AppSoundFactory factory.

getSoundID

public function getSoundID():String

Returns sound id associated to button click.

addActionListener

public function addActionListener(fuc:Function, obj:Object):Object

addActionListener(fuc:Function, obj:Object)
addActionListener(fuc:Function)

Adds a action listener to this button. Buttons fire a action event when user released on it.

Parameters

fucthe listener function.

Return

the listener just added.

See Also

  • EventDispatcher#ON_ACT
  • Component#ON_RELEASE

setEnabled

public function setEnabled(b:Boolean):Void

Enable or disable the component.

setNormalColor

public function setNormalColor(color:ASColor):Void

Sets foreground color for "normal" button state.

getNormalColor

public function getNormalColor():ASColor

Returns foreground color for "normal" button state.

setHightlightColor

public function setHightlightColor(color:ASColor):Void

Sets foreground color for "hightlight" button state.

getHightlightColor

public function getHightlightColor():ASColor

Returns foreground color for "hightlight" button state.

setDisabledColor

public function setDisabledColor(color:ASColor):Void

Sets foreground color for "disabled" button state.

getDisabledColor

public function getDisabledColor():ASColor

Returns foreground color for "disabled" button state.

setShortcut

public function setShortcut(key:KeyDefinition, keymapID:String):Void

Sets new key shortcut to button.

Pass key == null to enable built-in label shortcut definition.

releaseShortcut

public function releaseShortcut():Void

Releases key shortcut associated to button.

setLocalisationID

public function setLocalisationID(nodeID:String):Void

Connects button to localisation API.

Parameters

nodeIDFull qualified node path to translation node in local file

getLocalisationID

public function getLocalisationID():String

Returns translation node path.

setToolTipText

public function setToolTipText(caption:String):Void

Registers the text to display in a tool tip.

Take care if a shortcut is defined.
If true add '( shortcut name )' at the end of tooltip.

getTooltipTextWithoutShortcut

public function getTooltipTextWithoutShortcut():String

Returns tooltips without shortcut caption.

setFont

public function setFont(newFont:ASFont):Void

Sets the text font for this component.
this method will cause a repaint and revalidate method call.

Parameters

newFontthe font to set for this component.