Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class SlideShow

  1. Object
  2. Component
  3. Container
  4. SlideShow

ImplementsAnimation, Editable, Iterable<Component>, StyleListener

Plays a presentation: slide transitions, builds, and charts that animate in as their slide appears.

Tap the right two thirds, swipe left, or press right, down, space or fire to advance; tap the left third, swipe right, or press left or up to go back. Hidden slides are skipped. In presenter mode the slide shares the screen with the next slide, the speaker notes and the elapsed time, for a second display or a rehearsal.

void play(byte[] bytes) throws IOException {
    Form f = new Form("Deck", new BorderLayout());
    SlideShow show = new SlideShow(Presentation.read(bytes));
    show.addSlideListener(e -> Log.p("now on slide " + show.getSlideIndex()));
    f.add(BorderLayout.CENTER, show);
    f.show();
}

Transitions and builds move on com.codename1.ui.animations.Motion against AnimationTime, and the frames are painted by SlideAnimation, so a frame at any progress can be rendered exactly. Charts on screen are live com.codename1.ui.chart.Chart components that play their own entrance animation.

Constructors

public SlideShow(Presentation presentation)A slide show of a presentation, on its first visible slide.

Methods

public final void setPresentation(Presentation value)Shows another presentation from its first visible slide.
public Presentation getPresentation()The presentation.
public int getSlideIndex()The index of the slide showing.
public int getBuildStep()How many click steps of the current slide’s builds have played.
public SlideRenderer getRenderer()The renderer slides are painted with.
public void setPresenterMode(boolean value)Turns presenter mode on or off: the next slide, the notes and a timer beside the slide.
public boolean isPresenterMode()True in presenter mode.
public void setLiveCharts(boolean value)Chooses whether charts are live components that animate in, the default, or painted as still pictures.
public void addSlideListener(ActionListener<ActionEvent> l)Adds a listener told after every change of slide or build step.
public void removeSlideListener(ActionListener<ActionEvent> l)Removes a listener.
public boolean next()Plays the next build step, or moves to the next slide when every build has played.
public boolean previous()Undoes the last build step, or moves to the previous slide with all of its builds played.
public void goTo(int slideIndex)Jumps to a slide with no transition and none of its click builds played.
public void paintBackground(Graphics g)This method paints the Component background, it should be overriden by subclasses to perform custom background drawing.
public void paint(Graphics g)This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API’s to let the PLAF perform the rendering.
protected void initComponent()Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state
protected void deinitialize()Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
public boolean animate()Allows the animation to reduce “repaint” calls when it returns false.
public void keyReleased(int keyCode)If this Component is focused, the key released event will call this method
public void pointerPressed(int x, int y)If this Component is focused, the pointer pressed event will call this method
public void pointerReleased(int x, int y)If this Component is focused, the pointer released event will call this method

Inherited fields

Inherited methods

From Container

encloseIn, encloseIn, initLaf, getUIManager, setUIManager, isSurface, add, addAll, add, add, add, add, add, getLeadComponent, setLeadComponent, getLeadParent, keyPressed, getLayout, setLayout, invalidate, setShouldLayout, setShouldCalcPreferredSize, getLayoutWidth, getLayoutHeight, applyRTL, constrainWidthWhenScrollable, constrainHeightWhenScrollable, addComponent, addComponent, addComponent, addComponent, replaceAndWait, replaceAndWait, replace, replaceAndWait, replace, createReplaceTransition, isEnabled, setEnabled, removeComponent, cancelRepaints, flushReplace, removeAll, revalidateWithAnimationSafety, revalidate, revalidateLater, forceRevalidate, clearClientProperties, paintGlass, layoutContainer, isSafeArea, setSafeArea, isSafeAreaRoot, getSafeAreaRoot, setSafeAreaRoot, getComponentCount, getComponentAt, getComponentIndex, contains, scrollComponentToVisible, getClosestComponentTo, getResponderAt, getComponentAt, findDropTargetAt, calcPreferredSize, paramString, refreshTheme, isScrollableX, setScrollableX, isScrollableY, setScrollableY, getSideGap, getBottomGap, setScrollable, setCellRenderer, getScrollIncrement, setScrollIncrement, findFirstFocusable, dragInitiated, fireClicked, isSelectableInteraction, getGridPosY, paintComponentBackground, getGridPosX, animateHierarchyAndWait, createAnimateHierarchy, animateHierarchy, animateHierarchyFadeAndWait, createAnimateHierarchyFade, animateHierarchyFade, animateLayoutFadeAndWait, createAnimateLayoutFadeAndWait, animateLayoutFade, createAnimateLayoutFade, animateLayoutAndWait, animateLayout, updateTabIndices, createAnimateLayout, drop, createAnimateMotion, morph, morphAndWait, animateUnlayout, animateUnlayoutAndWait, createAnimateUnlayout, getChildrenAsList, iterator, iterator

From Component

setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, setWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getDragRegionStatus, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, calcScrollSize, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, focusGained, focusLost, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, getSelectedRect, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, isScrollable, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, getPreferredTabIndex, setPreferredTabIndex, isTraversable, setTraversable, handlesInput, setHandlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, longKeyPress, keyRepeated, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, shouldRenderComponentSelection, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, pointerHover, stopScrollMomentum, pointerHoverReleased, pointerHoverPressed, pinch, pinchReleased, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, drawDraggedImage, draggingOver, dragEnter, dragExit, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, pointerDragged, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerReleased, longPointerPress, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, getTextSelectionSupport, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, getContextMenuCommands, setContextMenuCommands, mouseWheel, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getStyle, getPressedStyle, getHoverStyle, setHoverStyle, isHovered, setHovered, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, setUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, refreshTheme, refreshTheme, isDragActivated, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, startEditingAsync, stopEditing, isEditing, isEditable, laidOut, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, isTactileTouch, setTactileTouch, getPropertyNames, getPropertyTypes, getPropertyTypeNames, getPropertyValue, setPropertyValue, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip

Constructor details

SlideShow

public SlideShow(Presentation presentation)
A slide show of a presentation, on its first visible slide.

Parameters

presentation Presentation
the presentation

Method details

setPresentation

public final void setPresentation(Presentation value)
Shows another presentation from its first visible slide.

Parameters

value Presentation
the presentation

getPresentation

public Presentation getPresentation()
The presentation.

Returns

the presentation

getSlideIndex

public int getSlideIndex()
The index of the slide showing.

Returns

the index into Presentation.getSlides()

getBuildStep

public int getBuildStep()
How many click steps of the current slide’s builds have played.

Returns

the step

getRenderer

public SlideRenderer getRenderer()
The renderer slides are painted with.

Returns

the renderer

setPresenterMode

public void setPresenterMode(boolean value)
Turns presenter mode on or off: the next slide, the notes and a timer beside the slide.

Parameters

value boolean
true for presenter mode

isPresenterMode

public boolean isPresenterMode()
True in presenter mode.

Returns

true when presenting

setLiveCharts

public void setLiveCharts(boolean value)
Chooses whether charts are live components that animate in, the default, or painted as still pictures.

Parameters

value boolean
false for still charts

addSlideListener

public void addSlideListener(ActionListener<ActionEvent> l)
Adds a listener told after every change of slide or build step.

Parameters

l ActionListener<ActionEvent>
the listener

removeSlideListener

public void removeSlideListener(ActionListener<ActionEvent> l)
Removes a listener.

Parameters

l ActionListener<ActionEvent>
the listener

next

public boolean next()
Plays the next build step, or moves to the next slide when every build has played.

Returns

false at the end of the presentation

previous

public boolean previous()
Undoes the last build step, or moves to the previous slide with all of its builds played.

Returns

false at the start of the presentation

goTo

public void goTo(int slideIndex)
Jumps to a slide with no transition and none of its click builds played.

Parameters

slideIndex int
the slide

paintBackground

public void paintBackground(Graphics g)
This method paints the Component background, it should be overriden by subclasses to perform custom background drawing.

Parameters

g Graphics
the component graphics

paint

public void paint(Graphics g)
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API’s to let the PLAF perform the rendering.

Parameters

g Graphics
the component graphics

initComponent

protected void initComponent()
Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state

deinitialize

protected void deinitialize()
Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.

animate

public boolean animate()
Allows the animation to reduce “repaint” calls when it returns false. It is called once for every frame. Frames are defined by the com.codename1.ui.Display class.

Returns

true if a repaint is desired or false if no repaint is necessary

keyReleased

public void keyReleased(int keyCode)
If this Component is focused, the key released event will call this method

Parameters

keyCode int
the key code value to indicate a physical key.

pointerPressed

public void pointerPressed(int x, int y)
If this Component is focused, the pointer pressed event will call this method

Parameters

x int
the pointer x coordinate
y int
the pointer y coordinate

pointerReleased

public void pointerReleased(int x, int y)
If this Component is focused, the pointer released event will call this method

Parameters

x int
the pointer x coordinate
y int
the pointer y coordinate