PopupMenu

class PopupMenu extends Component with Wrapper with Publisher
A popup menu component.
Example usage:
{{{
val popupMenu = new PopupMenu {
contents += new Menu("menu 1") {
contents += new RadioMenuItem("radio 1.1")
contents += new RadioMenuItem("radio 1.2")
}
contents += new Menu("menu 2") {
contents += new RadioMenuItem("radio 2.1")
contents += new RadioMenuItem("radio 2.2")
}
}
val button = new Button("Show Popup Menu")
reactions += {
case e: ButtonClicked => popupMenu.show(button, 0, button.bounds.height)
}
listenTo(button)
}}}
The component publishes PopupMenuCanceled, PopupMenuWillBecomeInvisible and PopupMenuWillBecomeVisible
events which can be used to determine when the menu is opened or closed.
Authors
John Sullivan
Ingo Maier
Hanns Holger Rutz
See also
javax.swing.JPopupMenu
trait Wrapper
trait Wrapper
trait SequentialContainer
trait Container
class Component
trait PeerContainer
trait UIElement
trait LazyPublisher
trait Publisher
trait Reactor
trait Proxy
class Object
trait Matchable
class Any

Type members

Inherited classlikes

object mouse
Contains publishers for various mouse events. They are separated for
efficiency reasons.
Inhertied from
Component
object keys
Inhertied from
Component
protected class Content
Inhertied from
Wrapper

Value members

Methods

def show(invoker: Component, x: Int, y: Int): Unit
Attaches the menu to a given component and makes it visible at the relative coordinates.
Value Params
invoker
the component to which the menu is logically attached
x
the horizontal coordinate of the top-left corner of the menu, relative to the invoker's position
y
the vertical coordinate of the top-left corner of the menu, relative to the invoker's position
def margin: Insets
def label: String
Gets or sets the popup menu's label. Different look and feels may choose
to display or not display this.
def label_=(s: String): Unit

Fields

lazy override val peer: JPopupMenu

Inherited methods

def scala$swing$LazyPublisher$$super$unsubscribe(listener: Reaction): Unit
Inhertied from
LazyPublisher
override def toString: String
Definition Classes
Component -> Proxy -> Any
Inhertied from
Component
def foreground: Color
Inhertied from
UIElement
def bounds: Rectangle
Inhertied from
UIElement
def preferredSize_=(x: Dimension): Unit
Inhertied from
UIElement
def locale: Locale
Inhertied from
UIElement
def ignoreRepaint: Boolean
Inhertied from
UIElement
def visible: Boolean
Inhertied from
UIElement
def cursor: Cursor
Inhertied from
UIElement
def deafTo(ps: Publisher*): Unit
Installed reaction won't receive events from the given publisher anylonger.
Inhertied from
Reactor
def xLayoutAlignment_=(x: Double): Unit
Inhertied from
Component
def tooltip_=(t: String): Unit
Inhertied from
Component
def publish(e: Event): Unit
Notify all registered reactions.
Inhertied from
Publisher
def border: Border
Inhertied from
Component
def location: Point
Inhertied from
UIElement
def name_=(s: String): Unit
Inhertied from
Component
def yLayoutAlignment: Double
Inhertied from
Component
def ignoreRepaint_=(b: Boolean): Unit
Inhertied from
UIElement
def cursor_=(c: Cursor): Unit
Inhertied from
UIElement
def border_=(b: Border): Unit
Inhertied from
Component
def size: Dimension
Inhertied from
UIElement
def componentOrientation: ComponentOrientation
Inhertied from
UIElement
def toolkit: Toolkit
Inhertied from
UIElement
def name: String
Inhertied from
Component
def enabled: Boolean
Inhertied from
Component
def tooltip: String
Inhertied from
Component
def minimumSize: Dimension
Inhertied from
UIElement
def maximumSize: Dimension
Inhertied from
UIElement
def background_=(c: Color): Unit
Inhertied from
UIElement
def font: Font
Inhertied from
UIElement
def listenTo(ps: Publisher*): Unit
Listen to the given publisher as long as deafTo isn't called for
them.
Inhertied from
Reactor
def validate(): Unit
Inhertied from
UIElement
def showing: Boolean
Inhertied from
UIElement
def focusable: Boolean
Inhertied from
Component
def enabled_=(b: Boolean): Unit
Inhertied from
Component
def componentOrientation_=(x: ComponentOrientation): Unit
Inhertied from
UIElement
def visible_=(b: Boolean): Unit
Inhertied from
UIElement
def font_=(f: Font): Unit
Inhertied from
UIElement
def repaint(rect: Rectangle): Unit
Inhertied from
UIElement
def repaint(): Unit
Inhertied from
UIElement
override def unsubscribe(listener: Reaction): Unit
Definition Classes
LazyPublisher -> Publisher
Inhertied from
LazyPublisher
def preferredSize: Dimension
Inhertied from
UIElement
def background: Color
Inhertied from
UIElement
def displayable: Boolean
Inhertied from
UIElement
def maximumSize_=(x: Dimension): Unit
Inhertied from
UIElement
def yLayoutAlignment_=(y: Double): Unit
Inhertied from
Component
def self: Any
Inhertied from
UIElement
def locationOnScreen: Point
Inhertied from
UIElement
def paint(g: Graphics2D): Unit
Inhertied from
Component
def scala$swing$LazyPublisher$$super$subscribe(listener: Reaction): Unit
Inhertied from
LazyPublisher
def focusable_=(b: Boolean): Unit
Inhertied from
Component
override def subscribe(listener: Reaction): Unit
Definition Classes
LazyPublisher -> Publisher
Inhertied from
LazyPublisher
def opaque_=(b: Boolean): Unit
Inhertied from
Component
override def hashCode(): Int
Definition Classes
Proxy -> Any
Inhertied from
Proxy
def foreground_=(c: Color): Unit
Inhertied from
UIElement
def inputVerifier_=(v: Component => Boolean): Unit
Inhertied from
Component
def revalidate(): Unit
Inhertied from
Component
def xLayoutAlignment: Double
Used by certain layout managers, e.g., BoxLayout or OverlayLayout to
align components relative to each other.
Inhertied from
Component
def hasFocus: Boolean
Inhertied from
Component
def requestFocusInWindow(): Boolean
Inhertied from
Component
def opaque: Boolean
Inhertied from
Component
def inputVerifier: Component => Boolean
Inhertied from
Component
def minimumSize_=(x: Dimension): Unit
Inhertied from
UIElement
override def equals(that: Any): Boolean
Definition Classes
Proxy -> Any
Inhertied from
Proxy
def requestFocus(): Unit
Inhertied from
Component

Inherited fields

override val contents: Buffer[Component]
Inhertied from
Wrapper
val reactions: Reactions
All reactions of this reactor.
Inhertied from
Reactor
protected val _contents: Content
Inhertied from
Wrapper
protected val listeners: RefSet[Reaction]
Inhertied from
Publisher