public abstract class Displayable
extends java.lang.Object
Displayable
is an abstract class which defines the very objects that can be shown on a
Display
.Displayable
object is built for a specific Display
which can not be changed afterwards. A
Displayable
may be shown or hidden, but at most one Displayable
is shown per
Display
.Displayable
contents and their possible interactions with the user.Displayable
object is not visible on its display.Display
Constructor and Description |
---|
Displayable(Display display)
The newly created displayable is built for the given display and is hidden.
|
Modifier and Type | Method and Description |
---|---|
abstract EventHandler |
getController()
Gets the displayable controller or
null if none. |
Display |
getDisplay()
Gets the displayable's display.
|
void |
hide()
Sets the displayable as hidden on its display.
|
protected void |
hideNotify()
This method is called by system as soon as the displayable becomes hidden.
|
boolean |
isShown()
Checks whether the displayable is visible on its display.
|
abstract void |
paint(GraphicsContext g)
Draws the displayable.
|
void |
repaint()
Requests a repaint for the entire displayable.
|
void |
show()
Sets the displayable as visible on its display.
|
protected void |
showNotify()
This method is called by system as soon as the displayable becomes visible.
|
public Displayable(Display display)
display
- the display for which the displayable is createdjava.lang.NullPointerException
- if the given display is null
public Display getDisplay()
The returned display can't be null
.
public boolean isShown()
true
if the displayable is currently visible, false
otherwisepublic void show() throws java.lang.SecurityException
java.lang.SecurityException
- if a security manager exists and does not allow the caller to get the display.public void hide()
protected void showNotify()
protected void hideNotify()
public void repaint()
paint(GraphicsContext)
on the displayable.
If the displayable is not visible, this call has no effect.
The call(s) to paint(GraphicsContext)
occurs asynchronously to this call. That is, this method will not
block waiting for paint(GraphicsContext)
to finish.
To synchronize with the paint(GraphicsContext)
routine, applications can use either
Display.callSerially(Runnable)
or Display.waitForEvent()
, or they can code explicit
synchronization into their paint(GraphicsContext)
routine.
public abstract void paint(GraphicsContext g)
g
- the GraphicsContext
of the displayable's Display
.public abstract EventHandler getController()
null
if none.null
.