Package VASSAL.tools.imageop
Class Repainter
java.lang.Object
VASSAL.tools.imageop.Repainter
- All Implemented Interfaces:
ImageOpObserver
,OpObserver<BufferedImage>
An
ImageOpObserver
which repaints Component
s.
This class stores a reference to a Component
and a
rectangle of that component which will be repainted when
imageOpChange(VASSAL.tools.imageop.ImageOp, boolean)
is called and success
is true.- Since:
- 3.1.0
- Author:
- Joel Uckelman
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Callback which is run when the observedOp
is cancelled.void
failed
(Op<BufferedImage> op, ExecutionException e) Callback which is run when the observedOp
fails.void
imageOpChange
(ImageOp op, boolean success) Called when theImageOp
under observation completes.void
Callback which is run when the observedOp
is interrupted.void
succeeded
(Op<BufferedImage> op, BufferedImage img) Callback which is run when the observedOp
completes successfully.
-
Field Details
-
c
-
x
protected final int x -
y
protected final int y -
w
protected final int w -
h
protected final int h
-
-
Constructor Details
-
Repainter
Creates aRepainter
for the specified component and rectangle.Repainter
s will usually be constructed during paint operations on the Event Dispatch Thread, and so will be created in enormous quantities. In order to minimize object creation, always use this constructor ratherRepainter(Component c, Rectangle r)
, except in the case where theRectangle
already exists.- Parameters:
c
- the component to repaintx
- the x coordinate of the upper-left corner of the rectangle to repainty
- the y coordinate of the upper-left corner of the rectangle to repaintw
- the width of the rectangle to repainth
- the height of the rectangle to repaint- Throws:
IllegalArgumentException
- ifc == null
-
Repainter
Creates aRepainter
for the specified component and area.- Parameters:
c
- the component to be repaintedr
- the area to be repainted- Throws:
IllegalArgumentException
- ifc == null
-
-
Method Details
-
imageOpChange
Called when theImageOp
under observation completes.- Specified by:
imageOpChange
in interfaceImageOpObserver
- Parameters:
op
- theImageOp
being observedsuccess
- repaint theComponent
ifftrue
-
succeeded
Description copied from interface:OpObserver
Callback which is run when the observedOp
completes successfully.- Specified by:
succeeded
in interfaceOpObserver<BufferedImage>
- Parameters:
op
- the successfully completedOp
img
- the value of theOp
-
cancelled
Description copied from interface:OpObserver
Callback which is run when the observedOp
is cancelled.- Specified by:
cancelled
in interfaceOpObserver<BufferedImage>
- Parameters:
op
- the cancelledOp
e
- theCancellationException
thrown when theOp
was cancelled
-
interrupted
Description copied from interface:OpObserver
Callback which is run when the observedOp
is interrupted.- Specified by:
interrupted
in interfaceOpObserver<BufferedImage>
- Parameters:
op
- the interruptedOp
e
- theInterruptedException
thrown when theOp
was interrupted
-
failed
Description copied from interface:OpObserver
Callback which is run when the observedOp
fails.- Specified by:
failed
in interfaceOpObserver<BufferedImage>
- Parameters:
op
- the failedOp
e
- theExecutionException
thrown when theOp
failed
-