|
All Methods zio package context |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object zio.ZObject zio.ZBox
Use this class to make colored boxes which are optionally expandable.
There is an action
method which is invoked whenver there is
a mouseclick over the box. Make a subclass and override this
method if you want something interesting to happen then.
The actual Swing object that this class creates is a JPanel
.
Since you have direct access to that object (through the
getJPanel()
method) you can use this class for AWT drawings
as well. In that case you must change either the background or
the foreground color as, by default, they will be the same.
Some of your layouts may require you to have both an object and
some space expand in the same slice. With normal use of
ZRow
and ZCol
this would be impossible. With a
box that is colored the same as the slice's background color,
you can get around that restriction.
Do not put other Swing
entities into the panel returned by getJPanel()
. The
ZRow
, ZCol
, and ZComponent
methods
are provided so that you can place other Swing
objects into your window under a consistent layout
management.
Constructor Summary | |
ZBox()
Creates a box By default, the width and length of this box are both one twelfth the height of the screen (measured in pixels) and the color is the same default color that is used to write text (usually black). |
Method Summary | |
protected void |
action(boolean isLeftButton,
java.awt.Point point)
For execution when user clicks the mouse over the ZBox . |
ZBox |
background(java.awt.Color c)
Suffix that sets the background color. |
ZBox |
color(java.awt.Color c)
Sets the background color of the ZBox . |
ZBox |
debug(java.lang.String debugId)
Suffix that creates debug output. |
protected void |
enableMouseAction()
Method for causing the action() method to be
executed upon mouse clicks. |
ZBox |
expandH()
Suffix that enables horizontal stretching. |
ZBox |
expandV()
Suffix that enables vertical stretching. |
ZBox |
foreground(java.awt.Color c)
Suffix that sets the foreground color. |
javax.swing.JPanel |
getJPanel()
Get a reference to the underlying JPanel . |
ZBox |
size(java.awt.Dimension desiredSize)
Suffix that overrides the default size. |
Methods inherited from class zio.ZObject |
getSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZBox()
In Swing or AWT parlance, this implies the default background color of a box is the same as the default foreground color.
Method Detail |
public final ZBox color(java.awt.Color c)
ZBox
. Need not be used
as a suffix but when it is used as a suffix
the effect is the same as the
background
suffix
c
- the desired colorpublic final ZBox foreground(java.awt.Color c)
c
- the desired foreground colorpublic final ZBox background(java.awt.Color c)
color
suffix.
c
- the desired background colorpublic final ZBox size(java.awt.Dimension desiredSize)
desiredSize
- the desired sizepublic final ZBox expandH()
public final ZBox expandV()
public final ZBox debug(java.lang.String debugId)
debugId
- a string to identify this component
in the debug outputpublic final javax.swing.JPanel getJPanel()
JPanel
.
JPanel
controlled by this objectprotected void enableMouseAction()
action()
method to be
executed upon mouse clicks.
Has no discernable effect unless the action()
method is overridden in a subclass.
protected void action(boolean isLeftButton, java.awt.Point point)
ZBox
. In this base class the action()
method does nothing and is not invoked.
To cause this method to be invoked whenever the user clicks the mouse,
enableMouseAction()
ZObject
class, it is usually easier to use suffixes
this way.)
The point passed to action()
has the upper lefthand corner of the component as
its origin. The y coordinate is positive in a downward
direction.
isLeftButton
- true when the clicked button was the left
or "first" buttonpoint
- coordinates of the point where the
left mouse button was released
|
author context |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |