EventTarget

scalafx.event.EventTarget
See theEventTarget companion object
abstract class EventTarget(val delegate: EventTarget) extends SFXDelegate[EventTarget]

Wraps a JavaFX EventTarget.

Attributes

Companion
object
Graph
Supertypes
trait SFXDelegate[EventTarget]
class Object
trait Matchable
class Any
Known subtypes
class Service[T]
class ScheduledService[T]
class Task[T]
class Dialog[R]
class Alert
class ChoiceDialog[T]
class MenuItem
class Menu
class TableColumnBase[S, T]
class TableColumn[S, T]
class TreeTableColumn[S, T]
class TreeItem[T]
class Node
class SwingNode
class Canvas
class ImageView
class MediaView
class Shape
class Arc
class Circle
class CubicCurve
class Ellipse
class Line
class Path
class Polygon
class Polyline
class QuadCurve
class Rectangle
class SVGPath
class Text
class Shape3D
class Box
class Cylinder
class MeshView
class Sphere
class Camera
class LightBase
class AmbientLight
class PointLight
class SpotLight
class Parent
class Region
class Axis[T]
class CategoryAxis
class ValueAxis[T]
class NumberAxis
class Chart
class PieChart
class XYChart[X, Y]
class AreaChart[X, Y]
class BarChart[X, Y]
class BubbleChart[X, Y]
class LineChart[X, Y]
class ScatterChart[X, Y]
class StackedAreaChart[X, Y]
class StackedBarChart[X, Y]
class Control
class Accordion
class ButtonBar
class ChoiceBox[J]
class ComboBoxBase[T]
class ColorPicker
class ComboBox[T]
class DatePicker
class Labeled
class ButtonBase
class Button
class CheckBox
class Hyperlink
class MenuButton
class ToggleButton
class RadioButton
class Cell[T]
class DateCell
class IndexedCell[T]
class ListCell[T]
class CheckBoxListCell[T]
class ComboBoxListCell[T]
class TableCell[S, T]
class CheckBoxTableCell[S, T]
class ChoiceBoxTableCell[S, T]
class ComboBoxTableCell[S, T]
class TextFieldTableCell[S, T]
class TableRow[T]
class TreeCell[T]
class CheckBoxTreeCell[T]
class ComboBoxTreeCell[T]
class TreeTableCell[S, T]
class CheckBoxTreeTableCell[S, T]
class ComboBoxTreeTableCell[S, T]
class TreeTableRow[T]
class Label
class TitledPane
class ListView[T]
class MenuBar
class Pagination
class ProgressBar
class ScrollBar
class ScrollPane
class Separator
class Slider
class Spinner[T]
class SplitPane
class TabPane
class TableView[S]
class TextArea
class TextField
class ToolBar
class TreeTableView[S]
class TreeView[T]
class HTMLEditor
class Pane
class DialogPane
class AnchorPane
class BorderPane
class FlowPane
class GridPane
class HBox
class StackPane
class TilePane
class VBox
class TextFlow
class WebView
class Group
class SubScene
class Window
class PopupWindow
class PopupControl
class ContextMenu
class Tooltip
class Popup
class Stage
class PrimaryStage
class PrimaryStage
Show all

Members list

Type members

Classlikes

object FilterMagnet

Companion object implementing Magnet Pattern Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Companion object implementing Magnet Pattern Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait FilterMagnet[J <: Event, S <: SFXDelegate[J]]

Trait implementing Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Trait implementing Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object HandlerMagnet

Companion object implementing Magnet Pattern Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Companion object implementing Magnet Pattern Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait HandlerMagnet[J <: Event, S <: SFXDelegate[J]]

Trait implementing Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Trait implementing Magnet Pattern to avoid compilation error "ambiguous reference to overloaded definition"

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this EventTarget. This event target is not automatically added to the chain, so if it wants to process events, it needs to add an EventDispatcher for itself to the chain.

Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this EventTarget. This event target is not automatically added to the chain, so if it wants to process events, it needs to add an EventDispatcher for itself to the chain.

In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.

The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.

The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.

Value parameters

tail

the initial chain to build from

Attributes

Returns

the resulting event dispatch chain for this target

See also
def filterEvent[J <: Event, S <: Event & SFXDelegate[J]](eventType: EventType[J])(filter: FilterMagnet[J, S]): Subscription

Registers an event filter. Registered event filters get an event before any associated event handlers.

Registers an event filter. Registered event filters get an event before any associated event handlers.

Example of filtering mouse events

pane.filterEvent(MouseEvent.Any) {
  me: MouseEvent => {
    me.eventType match {
      case MouseEvent.MousePressed => {
        ...
      }
      case MouseEvent.MouseDragged => {
        ...
      }
      case _ => {
        ...
      }
    }
  }
}

or

pane.filterEvent(MouseEvent.Any) { () => println("Some mouse event handled") }

Type parameters

J

type JavaFX delegate of the event

S

ScalaFX type for J type wrapper.

Value parameters

eventType

type of events that will be handled.

filter

code handling the event, see examples above.

Attributes

def handleEvent[J <: Event, S <: Event & SFXDelegate[J]](eventType: EventType[J])(handler: HandlerMagnet[J, S]): Subscription

Registers an event handler. The handler is called when the node receives an Event of the specified type during the bubbling phase of event delivery.

Registers an event handler. The handler is called when the node receives an Event of the specified type during the bubbling phase of event delivery.

Example of handling mouse events

pane.handleEvent(MouseEvent.Any) {
  me: MouseEvent => {
    me.eventType match {
      case MouseEvent.MousePressed => ...
      case MouseEvent.MouseDragged => ...
      case _                       => {}
    }
  }
}

or

pane.handleEvent(MouseEvent.Any) { () => println("Some mouse event handled") }

Type parameters

J

type JavaFX delegate of the event

S

ScalaFX type for J type wrapper.

Value parameters

eventType

type of events that will be handled.

handler

code handling the event, see examples above.

Attributes

Returns

Returns a subscription that can be used to cancel/remove this event handler

Inherited methods

override def equals(ref: Any): Boolean

Verifies if a object is equals to this delegate.

Verifies if a object is equals to this delegate.

Value parameters

ref

Object to be compared.

Attributes

Returns

if the other object is equals to this delegate or not.

Definition Classes
SFXDelegate -> Any
Inherited from:
SFXDelegate
override def hashCode: Int

Attributes

Returns

The delegate hashcode

Definition Classes
SFXDelegate -> Any
Inherited from:
SFXDelegate
override def toString: String

Attributes

Returns

Returns the original delegate's toString() adding a [SFX] prefix.

Definition Classes
SFXDelegate -> Any
Inherited from:
SFXDelegate

Concrete fields

override val delegate: EventTarget

JavaFX object to be wrapped.

JavaFX object to be wrapped.

Attributes