Class fvaswing.components.FvButton

Description

FvButton class adds Fever features to basic JButton class.

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

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

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

Field Index

DEFAULT_CLICK_SOUND

Method Index

new FvButton()
getLocalisationID(), getSoundID(), getText(), getTooltipTextWithoutShortcut(), releaseShortcut(), setFont(), setLocalisationID(), setShortcut(), setSoundID(), setText(), setToolTipText(), toString()

Constructor Detail

FvButton

public function FvButton(caption, icon)

FvButton( text : String, icon : Icon )
FvButton( text : String )
FvButton( icon : Icon )

Field Detail

DEFAULT_CLICK_SOUND

static public DEFAULT_CLICK_SOUND:String
Defines default sound id to search in current AppSoundFactory sound lib.

Sound is not automatically added to button behaviour, use setSoundID() method to declare it.

Example

   var b : FvButton = new FvButton( "simple button" );
   b.setSoundID( FvButton.DEFAULT_CLICK_SOUND );
 

Method Detail

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.

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.

toString

public function toString():String

Returns string representation.