Swing interoperability – MiG InfoCom MiG Calendar AShape Developer Manual User Manual

Page 21

Advertising
background image

MiG InfoCom AB

absolute time. It has duration (time), tick count, repetition
type/count and a

Function

. It manages this information

including the ability to pause, stop, reverse and resume
animations.

Time lines are ever changing objects since there state is a
function of time + earlier state, which progresses outside our
control. To be able to read multiple properties from a

TimeLine

its state is "freezable" and when frozen they will

not change and you can read multiple values that will be
correct in relation to each other. You will probably not have to
bother with this though, but it is a feature needed to write
precise

Animator

s for instance.

Functions
This framework has the possibility to map frames to absolute
time non-linearly. This means that it is easy to do accelerated
fade ins and outs and to, for instance, create oscillating
animations. The default Function is

LinearFunction

which

maps time and frame in a linear fashion. Also provided is a
class

ExpFunction

which maps frames and time in

exponentially, making it simple to make accelerated or
retarding animations.

Swing Interoperability

The Basics
Swing is the standard GUI framework provided by Sun
Microsystems and is used to create user interfaces in Java.
The

AShape

component interacts with Swing both ways. It

can be used within a Swing

JComponent

and any

JComponent can be contained in a

AShape

and still be used

the normal way.

JComponents in AShapes
There is a special

AShape

thatcan contain a

JComponent

,

namely

JComponentAShape

. It will set the bounds of the

“wrapped”

JComponent

to the same as it would get itself

and as such provides a transparent glue to have a

JComponent

in an

AShape

. There are no special

requirements on the

JComponent

other than it still, as all

JComponent

s, need a valid parent. Normally this should be

AShape Developer Manual

Page 21 / 24

Advertising