public abstract class Slideshow extends Object implements KeyListener
Slide
s. Binds the left and
right arrow keys to forward/backward, 'q' to quit and 'f' to toggle
fullscreen mode. If the current slide being displayed is also a
KeyListener
then keypresses other than these will be passed to the
slide.Modifier and Type | Field and Description |
---|---|
protected RootPaneContainer |
container |
protected Slide |
currentSlide |
protected Component |
currentSlideComp |
protected int |
currentSlideIndex |
protected int |
slideHeight |
protected List<Slide> |
slides |
protected int |
slideWidth |
Constructor and Description |
---|
Slideshow(RootPaneContainer container,
List<Slide> slides,
int slideWidth,
int slideHeight,
BufferedImage background)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
displayNextSlide()
Display the next slide
|
void |
displayPrevSlide()
Display the previous slide
|
protected void |
displaySlide(Slide slide) |
protected abstract boolean |
isFullscreen() |
void |
keyPressed(KeyEvent e) |
void |
keyReleased(KeyEvent e) |
void |
keyTyped(KeyEvent e) |
protected abstract void |
pack() |
abstract void |
setFullscreen(boolean fullscreen)
Method allows changing whether this window is displayed in fullscreen or
windowed mode.
|
protected RootPaneContainer container
protected int currentSlideIndex
protected Component currentSlideComp
protected int slideWidth
protected int slideHeight
protected Slide currentSlide
public Slideshow(RootPaneContainer container, List<Slide> slides, int slideWidth, int slideHeight, BufferedImage background) throws IOException
container
- the root windowslides
- the slidesslideWidth
- the width to display the slidesslideHeight
- the height to display the slidesbackground
- a background image to display behind the slides (the slides need
to be transparent!)IOException
- if the first slide can't be loadedprotected abstract void pack()
public void displayNextSlide() throws IOException
IOException
public void displayPrevSlide() throws IOException
IOException
protected void displaySlide(Slide slide) throws IOException
IOException
public void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
protected abstract boolean isFullscreen()
public abstract void setFullscreen(boolean fullscreen)
fullscreen
- true = change to fullscreen, false = change to windowedpublic void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener